MonadRandomLazy- Lazy monad for psuedo random-number generation.

Portabilitynon-portable (multi-parameter type classes, undecidable instances)
Safe HaskellSafe



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.



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.

data Rand g a Source


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 g and produces a result of type a.

RandomGen g => Applicative (Rand g) Source 
RandomGen g => MonadRandom (Rand g) Source