CLAS - Clean Linear Algebra Subroutines

## Mersenne Twister
A uniform pseudorandom number generator - version 1.0.1

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 `[-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.

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 directly 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` | signed integer pseudorandom number generator | `Int -> [Int]` Input: Any nonzero integer as a seed value. Returns an infinite list of signed integer numbers, uniformly distributed over the interval `[-231, 231-1]`.