-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | random number library -- -- This package provides a basic random number generation library, -- including the ability to split random number generators. @package random @version 1.0.1.3 -- | This library deals with the common task of pseudo-random number -- generation. The library makes it possible to generate repeatable -- results, by starting with a specified initial random number generator, -- or to get different results on each run by using the -- system-initialised generator or by supplying a seed from some other -- source. -- -- The library is split into two layers: -- --
-- rollDice :: IO Int -- rollDice = getStdRandom (randomR (1,6)) --getStdRandom :: (StdGen -> (a, StdGen)) -> IO a -- | Gets the global random number generator. getStdGen :: IO StdGen -- | Sets the global random number generator. setStdGen :: StdGen -> IO () -- | Applies split to the current global random generator, updates -- it with one of the results, and returns the other. newStdGen :: IO StdGen -- | With a source of random number supply in hand, the Random class -- allows the programmer to extract random values of a variety of types. -- -- Minimal complete definition: randomR and random. class Random a where randomRs ival g = build (\ cons _nil -> buildRandoms cons (randomR ival) g) randoms g = build (\ cons _nil -> buildRandoms cons random g) randomRIO range = getStdRandom (randomR range) randomIO = getStdRandom random randomR :: (Random a, RandomGen g) => (a, a) -> g -> (a, g) random :: (Random a, RandomGen g) => g -> (a, g) randomRs :: (Random a, RandomGen g) => (a, a) -> g -> [a] randoms :: (Random a, RandomGen g) => g -> [a] randomRIO :: Random a => (a, a) -> IO a randomIO :: Random a => IO a instance Random CDouble instance Random CFloat instance Random Float instance Random Double instance Random Bool instance Random Char instance Random CUIntMax instance Random CIntMax instance Random CUIntPtr instance Random CIntPtr instance Random CULLong instance Random CLLong instance Random CSigAtomic instance Random CWchar instance Random CSize instance Random CPtrdiff instance Random CULong instance Random CLong instance Random CUInt instance Random CInt instance Random CUShort instance Random CShort instance Random CUChar instance Random CSChar instance Random CChar instance Random Word64 instance Random Word32 instance Random Word16 instance Random Word8 instance Random Word instance Random Int64 instance Random Int32 instance Random Int16 instance Random Int8 instance Random Int instance Random Integer instance Read StdGen instance Show StdGen instance RandomGen StdGen