Next: random device, Previous: random source, Up: random [Index]
The default randomness source of (vicare crypto randomisations)
is Pierre L’Ecuyer’s MRG32k3a generator:
P. L’Ecuyer. “Good Parameter Sets for Combined Multiple Recursive Random Number Generators”, Shorter version in Operations Research, 47, 1 (1999), 159–164.
P. L’Ecuyer, R. Simard, E. J. Chen, W. D. Kelton. “An Object–Oriented Random–Number Package With Many Long Streams and Substreams”. 2001. To appear in Operations Research.
Create and return a new randomness source using MRG32k3a, representing a
deterministic stream of random bits. Each returned randomness source
generates the same stream of values, unless the state is modified with
random-source-seed!
.
The state returned by random-source-state-ref
is a Scheme vector
of length 7, whose first value is the symbol
random-source-state/mrg32k3a
. All the other values in the vector
are positive integers.
The MRG32k3a generator produces values N in the range 0 <= N < 2^{32} - 209. A new pseudo–random number N is generated with the following computation starting from the state vectors [A1, A2, A3] and [B1, B2, B3]:
M1 = 4294967087 = 2^32 - 209 M2 = 4294944443 = 2^32 - 22853 c2 = 1403580 c3 = -810728 d1 = 527612 d3 = -1370589 A0 = ( c2 * A2 + c3 * A3) mod M1 B0 = (d1 * B1 + d3 * B3) mod M2 ; right-shift A, purging the old A3 A3 = A2 A2 = A1 A1 = A0 ; right-shift B, purging the old B3 B3 = B2 B2 = B1 B1 = B0 N = (A0 - B0) mod M1
notice that M1 and M2 are two prime numbers just below
2^{32}; c2, c3, d1 and d3 are called
recursion coefficients. The (vicare crypto
randomisations)
library defines the initial state vectors as:
A1 = 1062452522 A2 = 2961816100 A3 = 342112271 B1 = 2854655037 B2 = 3321940838 B3 = 3542344109
Next: random device, Previous: random source, Up: random [Index]