# MersenneTwister

The Mersenne Twister is a uniform pseudorandom number generator (for both real and integers), which has been developed by Makoto Matsumoto and Takuji Nishimura during 1996-1997.

The generated numbers have a period of 219937-1. They are uniformly distributed over the interval [0, 1] in the real case and over the interval [-231, 231-1] in the integer case.

Caveat: As Clean does not have 32-bit unsigned integers, the integer version of the Mersenne Twister returns 32-bit signed integers. Nevertheless in the real case the output of the Clean program equals the output of any reference implementation.

This implementation in Clean by Thorsten Zoerner is a rewrite of a C program by T. Nishimura which can be found on-line or e. g. in the paper

Mersenne Twister: A 623-dimensionally equidistributed uniform pseudorandom number generator by M. Matsumoto and T. Nishimura in ACM Transactions on Modeling and Computer Simulation, vol. 8, no. 1, January 1998, pp. 3-30.