Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8022762

Minor spec issue in j.u.SplittableRandom

XMLWordPrintable

      Methods:

      http://download.java.net/lambda/b102/docs/api/java/util/SplittableRandom.html#nextInt(int)
      http://download.java.net/lambda/b102/docs/api/java/util/SplittableRandom.html#nextDouble(double)
      http://download.java.net/lambda/b102/docs/api/java/util/SplittableRandom.html#nextLong(long)

      Specify:

      "Parameters: bound - the bound on the random number to be returned. Must be positive."

      but

      "Throws: IllegalArgumentException - if bound is less than zero"


      In fact zero bound leads to IllegalArgumentException as well.

              new SplittableRandom().nextInt(0);

      will throw

      Exception in thread "main" java.lang.IllegalArgumentException: bound must be positive
      at java.util.SplittableRandom.nextInt(SplittableRandom.java:476)




            psandoz Paul Sandoz
            dbessono Dmitry Bessonov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: