Copyright | Copyright (c) 2008, Don Stewart <dons@galois.com> |
---|---|
License | BSD3 |
Maintainer | Don Stewart <dons@galois.com> |
Stability | experimental |
Portability | CPP, FFI |
Safe Haskell | None |
Language | Haskell98 |
Tested with: GHC 6.8.3
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.
This generator may be used with System.Random, however, that is likely to be slower than using it directly.
The random number generator
PureMT
, a pure mersenne twister pseudo-random number generator
Introduction
newPureMT :: IO PureMT Source #
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
randomDouble :: PureMT -> (Double, PureMT) Source #
Efficiently yield a new 53-bit precise Double
value, and a new generator.