tf-random-0.5: High-quality splittable pseudorandom number generator

Copyright | (c) 2012-2013 Michał Pałka
License | BSD3
Maintainer | michal.palka@chalmers.se
Stability | experimental
Portability | portable
Safe Haskell | None
Language | Haskell98

System.Random.TF

Description

This module exports System.Random.TF.Gen and System.Random.TF.Init modules without exporting the alternative `RandomGen` class from System.Random.TF.Gen. To use this class and the `Random` instances written for it, please import System.Random.TF.Gen and System.Random.TF.Instances directly.

Synopsis

- data TFGen
- seedTFGen :: (Word64, Word64, Word64, Word64) -> TFGen
- newTFGen :: IO TFGen
- mkTFGen :: Int -> TFGen
- mkSeedTime :: IO (Word64, Word64, Word64, Word64)
- mkSeedUnix :: IO (Word64, Word64, Word64, Word64)

# Documentation

data TFGen Source #

The generator type

#### Instances

Instances details

Read TFGen Source # |
Instance details Defined in System.Random.TF.Gen Methods readsPrec :: Int -> ReadS TFGen Source # readList :: ReadS [TFGen] Source # readPrec :: ReadPrec TFGen Source # readListPrec :: ReadPrec [TFGen] Source #
Show TFGen Source # |
Instance details Defined in System.Random.TF.Gen Methods showsPrec :: Int -> TFGen -> ShowS Source # show :: TFGen -> String Source # showList :: [TFGen] -> ShowS Source #
RandomGen TFGen Source # |

Instance details

Defined in System.Random.TF.Gen

Methods

next :: TFGen -> (Int, TFGen) Source #

genWord8 :: TFGen -> (Word8, TFGen) Source #

genWord16 :: TFGen -> (Word16, TFGen) Source #

genWord32 :: TFGen -> (Word32, TFGen) Source #

genWord64 :: TFGen -> (Word64, TFGen) Source #

genWord32R :: Word32 -> TFGen -> (Word32, TFGen) Source #

genWord64R :: Word64 -> TFGen -> (Word64, TFGen) Source #

genShortByteString :: Int -> TFGen -> (ShortByteString, TFGen) Source #

genRange :: TFGen -> (Int, Int) Source #

split :: TFGen -> (TFGen, TFGen) Source #

RandomGen TFGen Source # |
Instance details Defined in System.Random.TF.Gen Methods next :: TFGen -> (Word32, TFGen) Source # split :: TFGen -> (TFGen, TFGen) Source # splitn :: TFGen -> Int -> Word32 -> TFGen Source # level :: TFGen -> TFGen Source #

seedTFGen :: (Word64, Word64, Word64, Word64) -> TFGen Source #

Create a generator from a random seed.

newTFGen :: IO TFGen Source #

Derive a new generator instance from the global RNG using split. This is the default way of obtaining a new RNG instance. Initial generator is seeded using `mkSeedUnix` on UNIX, and `mkSeedTime` otherwise. This should be eventually replaced with proper seeding.

mkTFGen :: Int -> TFGen Source #

Quick and dirty way of creating a deterministically seeded generator.

mkSeedTime :: IO (Word64, Word64, Word64, Word64) Source #

Use system time create the random seed. This method of seeding may not be relible.

mkSeedUnix :: IO (Word64, Word64, Word64, Word64) Source #

Use the UNIX special file `/dev/urandom` to create the seed. Inspired by `random-mwc`.