Clean

Mersenne Twister
A uniform pseudorandom number generator - version 1.0

Download

Version history

.tar.gz

.zip

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 [0, 231-1] in the integer case.

We refer to the Mersenne Twister Homepage for details and implementations in other languages.

This implementation in Clean 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. (PostScript)

Comments, remarks and suggestions are very welcome and should be made to Thorsten Zoerner (zoerner@cs.kun.nl).


MersenneTwister

function name types/remarks
getRandReal real pseudorandom number generator Int -> [Real]

Input: Any nonzero integer as a seed value.
Returns an infinite list of real numbers, uniformly distributed over the interval [0, 1].
getRandInt integer pseudorandom number generator Int -> [Int]

Input: Any nonzero integer as a seed value.
Returns an infinite list of integer numbers, uniformly distributed over the interval [0, 231-1].