Portability | non-portable (multi-parameter type classes, undecidable instances) |
---|---|
Safe Haskell | Safe |
Language | Haskell98 |
License : BSD3
A lazy monad for random-number generation. This monad allows, for example, computation of infinite random lists.
This monad respects the interface defined by
MonadRandom
.
A monadic computation is one that consumes random values.
The bind operation works like the Gen
monad in QuickCheck
:
it does not thread the random seed; instead it *splits* the random seed.
- module System.Random
- module Control.Monad.Random.Class
- evalRand :: RandomGen g => Rand g a -> g -> a
- runRand :: RandomGen g => Rand g a -> g -> (a, g)
- evalRandIO :: Rand StdGen a -> IO a
- data Rand g a
Documentation
module System.Random
module Control.Monad.Random.Class
evalRand :: RandomGen g => Rand g a -> g -> a Source
Evaluate a random computation using the generator g
. The
new g
is discarded.
runRand :: RandomGen g => Rand g a -> g -> (a, g) Source
Run a random computation using the generator g
, returning the result
and a new generator.
evalRandIO :: Rand StdGen a -> IO a Source
Evaluate a random computation in the IO monad, using the random number
generator supplied by getStdRandom
.
RandomGen g => MonadSplit g (Rand g) Source | |
RandomGen g => Monad (Rand g) Source | |
Functor (Rand g) Source | A value of type 'Rand g a' is a monadic computation which, when
run, consumes random values from an applicative random-number generator
of type |
RandomGen g => Applicative (Rand g) Source | |
RandomGen g => MonadRandom (Rand g) Source |