Xorshift random generators. The generators are implemented according to
the paper http://www.jstatsoft.org/v08/i14/paper by George Marsaglia.
You can use the RandomGen
instances to generate random numbers easily.
This module only exports the Random generator that matches your word size,
if you want to use a specific length, try Random.Xorshift.Int32 and
Random.Xorshift.Int64 instead.
- type Xorshift = Xorshift32
- newXorshift :: IO Xorshift
- makeXorshift :: Integral a => a -> Xorshift
- module System.Random
Documentation
type Xorshift = Xorshift32Source
The type Xorshift is a wrapper around either Xorshift32 or Xorshift64, depending on the bit size of your system. The idea behind this is, that you may want to use this package as an uncomplicated, fast random generator, but repeated conversion between different word sizes are an absolute performance killer.
Thus, if you don't really care about the period of your random generator or
how long the result is, use the Xorshift
synonym, whenever possible.
newXorshift :: IO XorshiftSource
Generates a new Xorshift from the current time. This is either a synonym
for newXorshift32
or newXorshift64
.
makeXorshift :: Integral a => a -> XorshiftSource
Generate a new Xorshift
generator, regardless of whatever it's bytesize
is on your platform.
module System.Random