[math] nextDouble

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[math] nextDouble

Matt Bru
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?
Reply | Threaded
Open this post in threaded view
|

Re: [math] nextDouble

David Cogen
On 03/09/2018 04:35 PM, Matt Bru wrote:

> 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?
>
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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [math] nextDouble

Gilles Sadowski
In reply to this post by Matt Bru
On Fri, 9 Mar 2018 16:35:57 -0500, Matt Bru wrote:
> 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

>
> 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?


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [math] nextDouble

Gilles Sadowski
In reply to this post by David Cogen
On Fri, 9 Mar 2018 16:53:21 -0500, David Cogen wrote:

> On 03/09/2018 04:35 PM, Matt Bru wrote:
>> 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?
>>
> 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: [hidden email]
For additional commands, e-mail: [hidden email]