Wrapper for the Mersenne twister.
The Mersenne twister is a pseudorandom number generator linked to
CR developed in 1997 by Makoto Matsumoto and Takuji Nishimura that
is based on a matrix linear recurrence over a finite binary field
F2. It provides for fast generation of very high quality pseudorandom
numbers, having been designed specifically to rectify many of the
flaws found in older algorithms.
Mersenne Twister has the following desirable properties:
1. It was designed to have a period of 2^19937 - 1 (the creators
of the algorithm proved this property).
2. It has a very high order of dimensional equidistribution.
This implies that there is negligible serial correlation between
successive values in the output sequence.
3. It passes numerous tests for statistical randomness, including
the stringent Diehard tests.
4. It is fast.
- uint next();
- returns a random uint
- ubyte nextB();
- returns a random byte
- ulong nextL();
- returns a random long
- void seed(uint s);
- initializes the generator with a uint as seed
- void addEntropy(scope uint delegate() r);
- adds entropy to the generator
- void seed(scope uint delegate() r);
- seeds the generator
- char[] toString();
- writes the current status in a string
- size_t fromString(const(char[]) s);
- reads the current status from a string (that should have been trimmed)
returns the number of chars read