-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Haskell implementation of the xorshift random generator.
--
-- The Xorshift random generator is a very fast generator that uses only
-- XOR and bitshifting operations. This package contains a basic version
-- with a periode of 2^32-1 for 32-bit numbers and a version with a
-- periode of 2^64-1 for 64-bit numbers.
--
-- Although the author didn't tested the random generator, but according
-- to it's specification the resulting numbers are of good quality.
@package xorshift
@version 2
-- | 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.
module Random.Xorshift.Int64
-- | 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.
newtype Xorshift64
Xorshift64 :: Int64 -> Xorshift64
-- | Generates a new Xorshift64 from the current time.
newXorshift64 :: IO Xorshift64
-- | Generate a new Xorshift64 generator. This is essentially a
-- wrapper around the constructor.
makeXorshift64 :: Integral a => a -> Xorshift64
-- | 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.
getInt64 :: Xorshift64 -> Int64
instance Eq Xorshift64
instance Show Xorshift64
instance Enum Xorshift64
instance Bounded Xorshift64
instance RandomGen Xorshift64
-- | This module contains a 32 bit Xorshift random generator. Use this if
-- you need a 32 bit random generator, usually Xorshift itself
-- is a good choice for your platform. This generator has a period of
-- 2^32-1 bits if initialized with a value different from 0.
module Random.Xorshift.Int32
-- | Xorshift generator with 32 bits. This Xorshift generator uses first a
-- left shift, then a right shift and again a left shift. It uses the
-- parameters 13, 17 and 5. See the paper for more details on how the
-- parameters affect the generation of random numbers.
--
-- The generator has a periode of 2^32-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.
newtype Xorshift32
Xorshift32 :: Int32 -> Xorshift32
-- | Generates a new Xorshift32 from the current time.
newXorshift32 :: IO Xorshift32
-- | Generate a new Xorshift32 generator. This is essentially a
-- wrapper around the constructor.
makeXorshift32 :: Integral a => a -> Xorshift32
-- | 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.
getInt32 :: Xorshift32 -> Int32
instance Eq Xorshift32
instance Show Xorshift32
instance Enum Xorshift32
instance Bounded Xorshift32
instance RandomGen Xorshift32
-- | 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.
module Random.Xorshift
-- | 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.
type Xorshift = Xorshift32
-- | Generates a new Xorshift from the current time. This is either a
-- synonym for newXorshift32 or newXorshift64.
newXorshift :: IO Xorshift
-- | Generate a new Xorshift generator, regardless of whatever it's
-- bytesize is on your platform.
makeXorshift :: Integral a => a -> Xorshift