-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | Generate high quality pseudorandom numbers purely using a Mersenne Twister
--   
--   The Mersenne twister is a pseudorandom number generator developed by
--   Makoto Matsumoto and Takuji Nishimura that is based on a matrix linear
--   recurrence over a finite binary field. It provides for fast generation
--   of very high quality pseudorandom numbers. The source for the C code
--   can be found here:
--   
--   http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt64.html
--   
--   This library provides a purely functional binding to the 64 bit
--   classic mersenne twister, along with instances of RandomGen, so the
--   generator can be used with System.Random. The generator should
--   typically be a few times faster than the default StdGen (but a tad
--   slower than the impure 'mersenne-random' library based on SIMD
--   instructions and destructive state updates.
@package mersenne-random-pure64
@version 0.2.2.0

-- | 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.
module System.Random.Mersenne.Pure64.Base
data MTState
type UInt64 = CULLong
c_init_genrand64 :: Ptr MTState -> UInt64 -> IO ()
c_genrand64_int64 :: Ptr MTState -> IO UInt64
c_genrand64_real2 :: Ptr MTState -> IO CDouble
sizeof_MTState :: Int
c_mix_word64 :: Word64 -> Word64
c_seed_genrand64_block :: Ptr a -> Word64 -> IO ()
c_next_genrand64_block :: Ptr a -> Ptr a -> IO ()

-- | length of an MT block
blockLen :: Int

-- | size of an MT block, in bytes
blockSize :: Int
c_init_genrand64_unsafe :: UInt64 -> IO ()
c_genrand64_int64_unsafe :: IO UInt64
c_genrand64_real2_unsafe :: IO CDouble
c_memcpy :: Ptr Word8 -> Ptr Word8 -> CSize -> IO (Ptr Word8)

module System.Random.Mersenne.Pure64.Internal

-- | PureMT, a pure mersenne twister pseudo-random number generator
data PureMT
PureMT :: {-# UNPACK #-} !MTBlock -> {-# UNPACK #-} !Int -> MTBlock -> PureMT

-- | length of an MT block
blockLen :: Int

-- | size of an MT block, in bytes
blockSize :: Int
data MTBlock
MTBlock :: ByteArray# -> MTBlock
instance GHC.Internal.Show.Show System.Random.Mersenne.Pure64.Internal.PureMT

-- | 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.
module System.Random.Mersenne.Pure64.MTBlock
data MTBlock

-- | create a new MT block, seeded with the given Word64 value
seedBlock :: Word64 -> MTBlock

-- | step: create a new MTBlock buffer from the previous one
nextBlock :: MTBlock -> MTBlock

-- | look up an element of an MT block
lookupBlock :: MTBlock -> Int -> Word64

-- | length of an MT block
blockLen :: Int

-- | MT's word mix function.
--   
--   (MT applies this function to each Word64 from the buffer before
--   returning it)
mixWord64 :: Word64 -> Word64

-- | 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.
module System.Random.Mersenne.Pure64

-- | PureMT, a pure mersenne twister pseudo-random number generator
data PureMT

-- | Create a PureMT generator from a Word64 seed.
pureMT :: Word64 -> PureMT

-- | Create a new PureMT generator, using the clocktime as the base for the
--   seed.
newPureMT :: IO PureMT

-- | Yield a new Int value from the generator, returning a new
--   generator and that Int. The full 64 bits will be used on a 64
--   bit machine.
randomInt :: PureMT -> (Int, PureMT)

-- | Yield a new Word value from the generator, returning a new
--   generator and that Word.
randomWord :: PureMT -> (Word, PureMT)

-- | Yield a new Int64 value from the generator, returning a new
--   generator and that Int64.
randomInt64 :: PureMT -> (Int64, PureMT)

-- | Yield a new Word64 value from the generator, returning a new
--   generator and that Word64.
randomWord64 :: PureMT -> (Word64, PureMT)

-- | Efficiently yield a new 53-bit precise Double value, and a new
--   generator.
randomDouble :: PureMT -> (Double, PureMT)
instance System.Random.Internal.RandomGen System.Random.Mersenne.Pure64.Internal.PureMT
