[erlang-questions] New random module?

Kenji Rikitake <>
Thu Nov 25 04:28:47 CET 2010


The state for XORshift is indeed 32 bytes or eight 32-bit words.  My
mistake.

The mantissa part of IEEE floats has 53 bits, so two calls of
32-bit integer RNGs will be sufficient (this is not only the XORshift
issue but also for other 32-bit integer-based RNGs).

So far as I know
XORshift 7-stage version RNG passed the Dieharder tests
as well as the 2006 Wichmann-Hill RNG (converted to 32-bit
unsigned integers) did.
(Both didn't pass all the tests for one key,
 but giving an independent seed made them pass the tests
 with "WEAK" or "FAILED" results.)

In the message <>
dated Thu, Nov 25, 2010 at 12:31:28PM +1300,
Richard O'Keefe <> writes:
> On 24/11/2010, at 9:41 PM, Kenji Rikitake wrote:
> 
> > In the message <>
> > dated Wed, Nov 24, 2010 at 05:00:01PM +0900,
> > Kenji Rikitake <> writes:
> >> * XORshift 7 stage (Panneton-L'Ecuyer, 2005[1], state: 8 bytes, period: 2^256-1)
> > 
> > [1] Francis Panneton and Pierre L'ecuyer. 2005. On the xorshift random
> > number generators. ACM Trans. Model. Comput. Simul. 15, 4 (October
> > 2005), 346-361. DOI=10.1145/1113316.1113319 http://doi.acm.org/10.1145/1113316.1113319
> 
> The C code for the 7 stage Xorshift generator displayed in figure 1
> of that paper has 32 bytes of state, not 8.  The 'doubles' you get
> from it have only 32 bits worth of randomness; the bottom 21 bits
> are 0.  The paper concludes by saying "These generators are fast,
> but not reliable, according to our analysis."  They don't report the
> results of tests on the 7 stage generator.


More information about the erlang-questions mailing list