xorshift-2: Haskell implementation of the xorshift random generator.

Random.Xorshift.Int64

Description

This module contains a 64 bit Xorshift random generator. Use this if you need a 64 bit random generator, usually Xorshift itself is a good choice for your platform. This generator has a period of 2^64-1 bits if initialized with a value different from 0.

Synopsis

Documentation

newtype Xorshift64 Source

Xorshift generator with 64 bits. This Xorshift generator uses first a left shift, then a right shift and again a left shift. It uses the parameters 13, 7 and 17. See the paper for more details on how the parameters affect the generation of random numbers.

The generator has a periode of 2^64-1, please notice that the generator has to be initialized with a value different from 0, elseway all future values will be zero as well.

Please notice, that the function split is not implemented and will result in a runtime error.

Constructors

Xorshift64 Int64 

newXorshift64 :: IO Xorshift64Source

Generates a new Xorshift64 from the current time.

makeXorshift64 :: Integral a => a -> Xorshift64Source

Generate a new Xorshift64 generator. This is essentially a wrapper around the constructor.

getInt64 :: Xorshift64 -> Int64Source

Get the raw contents of the random generator. This function is preferable over direct usage of the constructor itself, as the internal representation of the random generator may change in future releases.