mersenne-random-pure64- Generate high quality pseudorandom numbers purely using a Mersenne Twister

PortabilityTested with: GHC 6.8.3
MaintainerDon Stewart <>
Safe HaskellNone




A purely functional binding 64 bit binding to the classic mersenne twister random number generator. This is more flexible than the impure 'mersenne-random' library, at the cost of being a bit slower. This generator is however, many times faster than System.Random, and yields high quality randoms with a long period.


Block type

Block functions

seedBlock :: Word64 -> MTBlockSource

create a new MT block, seeded with the given Word64 value

nextBlock :: MTBlock -> MTBlockSource

step: create a new MTBlock buffer from the previous one

lookupBlock :: MTBlock -> Int -> Word64Source

look up an element of an MT block

Misc functions

blockLen :: IntSource

length of an MT block

mixWord64 :: Word64 -> Word64Source

MT's word mix function.

(MT applies this function to each Word64 from the buffer before returning it)