Next: Types and Structures [HB
Up: Language and System Features
Previous: Language and System Features
Random Object Generation [HB 1]
Magma V2.7 contains an implementation of the new MONSTER random number
generator due to G. Marsaglia [FSU, Tallahassee, FL].
The Monster generator has period
229430 - 227382 (approximately
108859) and passes all of the stringent tests in Marsaglia's Diehard test suite (available online at http://stat.fsu.edu/pub/diehard/).
The new generator is thus very much better than the previous linear
congruential generator, whose period was only 231-1 (for which
the full period could be easily exhausted).
Changes:
-
Because the new Monster generator uses an internal array of
machine integers, one `seed' variable no longer expresses the whole state,
so the method for setting or getting the generator state is now by
way of a pair of values: (1) the seed for initializing the array,
and (2) the number of steps performed since the initialization.
In detail:
-
The procedure SetSeed(s, c) now takes the initial seed s and
a step number c to advance to. SetSeed(s) is equivalent
to SetSeed(s, 0).
-
The function GetSeed() now returns the initial seed s used
to initialize the random-number generator and also the current step
c.
-
Starting from a given seed s, randomly generating any kind of
object using any random functions (including multi-precision
integers) will now produce exactly the same result, no matter which
machine type is used (including 64-bit machines versus 32-bit
machines).
Next: Types and Structures [HB
Up: Language and System Features
Previous: Language and System Features