commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilles <gil...@harfang.homelinux.org>
Subject [Math] JDK "Random" and "BitsStreamGenerator"
Date Tue, 26 Jan 2016 00:13:15 GMT
Hi.

In CM, a base class "BitsStreamGenerator" contains methods for
generating various primitive types from a bit source (to be
implemented by subclasses by overriding the "next(int bits)"
method).
For example, to get a random "long" value, the following code
is called:
---CUT---
     public long nextLong() {
         final long high  = ((long) next(32)) << 32;
         final long  low  = (next(32)) & 0xffffffffL;
         return high | low;
     }
---CUT---

If the bit source were provided by the JDK's "Random" class,
is it assumed that the "long" value generated by the above
code will always be equal to the "long" value generated by
the call to JDK's "Random" class?

In other words, how "standard" are the default implementations
of the methods defined in "BitsStreamGenerator"?

And what are the compatibility requirements with respect to
reproducibility of the sequences (between releases of the
library)?


Regards,
Gilles


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message