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

Copyright | Copyright (c) 2008 Bertram Felgenhauer <int-e@gmx.de>
License | BSD3
Maintainer | Don Stewart <dons@galois.com>
Stability | experimental
Portability |
Safe Haskell | None
Language | Haskell98

System.Random.Mersenne.Pure64.MTBlock

Contents

- Block type
- Block functions
- Misc functions

Description

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.

Synopsis

- data MTBlock
- seedBlock :: Word64 -> MTBlock
- nextBlock :: MTBlock -> MTBlock
- lookupBlock :: MTBlock -> Int -> Word64
- blockLen :: Int
- mixWord64 :: Word64 -> Word64

# Block type

data MTBlock Source #

# Block functions

seedBlock :: Word64 -> MTBlock Source #

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

nextBlock :: MTBlock -> MTBlock Source #

step: create a new MTBlock buffer from the previous one

lookupBlock :: MTBlock -> Int -> Word64 Source #

look up an element of an MT block

# Misc functions

blockLen :: Int Source #

length of an MT block

mixWord64 :: Word64 -> Word64 Source #

MT's word mix function.

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