mersenne-random-pure64-0.1.1: Generate high quality pseudorandom numbers purely using a Mersenne TwisterContentsIndex
System.Random.Mersenne.Pure64
PortabilityCPP, FFI
Stabilityexperimental
MaintainerDon Stewart <dons@galois.com>
Contents
The random number generator
Introduction
Low level access to the generator
Description

Tested with: GHC 6.8.2

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

This generator may be used with System.Random, however, that is likely to be slower than using it directly.

Synopsis
data PureMT
pureMT :: Word -> PureMT
newPureMT :: IO PureMT
randomInt :: PureMT -> (Int, PureMT)
randomWord :: PureMT -> (Word, PureMT)
randomInt64 :: PureMT -> (Int64, PureMT)
randomWord64 :: PureMT -> (Word64, PureMT)
randomDouble :: PureMT -> (Double, PureMT)
The random number generator
data PureMT
PureMT, a pure mersenne twister pseudo-random number generator
show/hide Instances
Introduction
pureMT :: Word -> PureMT
Create a PureMT generator from a Word seed.
newPureMT :: IO PureMT
Create a new PureMT generator, using the clocktime as the base for the seed.
Being purely functional, the PureMT generator is an instance of RandomGen. However, it doesn't support split yet.
Low level access to the generator
randomInt :: PureMT -> (Int, PureMT)
Yield a new Int value from the generator, returning a new generator and that Int. The full 64 bits will be used on a 64 bit machine.
randomWord :: PureMT -> (Word, PureMT)
Yield a new Word value from the generator, returning a new generator and that Word.
randomInt64 :: PureMT -> (Int64, PureMT)
Yield a new Int64 value from the generator, returning a new generator and that Int64.
randomWord64 :: PureMT -> (Word64, PureMT)
Yield a new Word64 value from the generator, returning a new generator and that Word64.
randomDouble :: PureMT -> (Double, PureMT)
Efficiently yield a new 53-bit precise Double value, and a new generator.
Produced by Haddock version 0.8