[Catching up after J1] On Sep 24, 2013, at 9:16 AM, Martin Buchholz <marti...@google.com> wrote:
> Stupid SplittableRandom tricks: > > System.out.println(sr.nextDouble(0.0d, > Double.POSITIVE_INFINITY)); > always prints constant 1.7976931348623157E308 > > which might be considered a bug. > Right, Double.MAX_VALUE. We thought not worth the effort of exhaustively supporting all possible IllegalArgumentException cases: nextDouble(+oo) => Double.MAX_VALUE nextDouble(-oo, finite) => NaN nextDouble(-oo, +oo) => NaN nextDouble(finite, +oo) => Double.MAX_VALUE > --- > > The spec below fails to be pedantically correct when one of the args is NaN. > > * @throws IllegalArgumentException if {@code origin} is greater than > * or equal to {@code bound} > */ > public double nextDouble(double origin, double bound) { > > Better to draw inspiration from the spec for > * @throws IllegalArgumentException if {@code bound} is not positive > */ > public double nextDouble(double bound) { > > and write: > > * @throws IllegalArgumentException if {@code bound - origin} is not > positive > */ > public double nextDouble(double origin, double bound) { > That would be a good change to tack on to that for the better reporting of incorrect bounds. Paul.