Discussion:
[math] nextDouble
(too old to reply)
Matt Bru
2018-03-09 21:35:57 UTC
Permalink
I have a question about org.apache.commons.math3.random.BitsStreamGenerator.



nextDouble() documents:

“Returns the next pseudorandom, uniformly distributed double value
between 0.0 and 1.0 from this random number generator's sequence.”



Is this 0 (inclusive) and 1.0 (exclusive) as java.util.Random is?
David Cogen
2018-03-09 21:53:21 UTC
Permalink
Post by Matt Bru
I have a question about org.apache.commons.math3.random.BitsStreamGenerator.
“Returns the next pseudorandom, uniformly distributed double value
between 0.0 and 1.0 from this random number generator's sequence.”
Is this 0 (inclusive) and 1.0 (exclusive) as java.util.Random is?
The question is practically moot. If the generator is truly random, then the
chance of getting 0 or 1 are essentially zero even if running at 1MHz for the
lifetime of the universe!

Still, it would be nice if that was stated definitively.



---------------------------------------------------------------------
To unsubscribe, e-mail: user-***@commons.apache.org
For additional commands, e-mail: user-***@commons.apache.org
Gilles
2018-03-10 04:02:24 UTC
Permalink
Post by David Cogen
Post by Matt Bru
I have a question about
org.apache.commons.math3.random.BitsStreamGenerator.
“Returns the next pseudorandom, uniformly distributed double value
between 0.0 and 1.0 from this random number generator's sequence.”
Is this 0 (inclusive) and 1.0 (exclusive) as java.util.Random is?
The question is practically moot. If the generator is truly random,
then the chance of getting 0 or 1 are essentially zero even if
running
at 1MHz for the lifetime of the universe!
Still, it would be nice if that was stated definitively.
I'd say "exclusive" but without any warranty. ;-)
The doc of "Commons RNG" has pointers to the references.
Review and patch welcome!

Regards,
Gilles


---------------------------------------------------------------------
To unsubscribe, e-mail: user-***@commons.apache.org
For additional commands, e-mail: user-***@commons.apache.org

Gilles
2018-03-10 03:59:35 UTC
Permalink
Post by Matt Bru
I have a question about
org.apache.commons.math3.random.BitsStreamGenerator.
Please note that the package "org.apache.commons.math3.random"
is deprecated (see [1]).

Regards,
Gilles

[1] http://commons.apache.org/rng
Post by Matt Bru
“Returns the next pseudorandom, uniformly distributed double value
between 0.0 and 1.0 from this random number generator's sequence.”
Is this 0 (inclusive) and 1.0 (exclusive) as java.util.Random is?
---------------------------------------------------------------------
To unsubscribe, e-mail: user-***@commons.apache.org
For additional commands, e-mail: user-***@commons.apache.org
Loading...