random-fu-0.0.3.2: Random number generation

Data.Random.RVar

Description

Random variables. An RVar is a sampleable random variable. Because probability distributions form a monad, they are quite easy to work with in the standard Haskell monadic styles. For examples, see the source for any of the Distribution instances - they all are defined in terms of RVars.

Synopsis

Documentation

type RVar = RVarT IdentitySource

An opaque type containing a "random variable" - a value which depends on the outcome of some random process.

runRVar :: RandomSource m s => RVar a -> s -> m aSource

data RVarT n a Source

A random variable with access to operations in an underlying monad. Useful examples include any form of state for implementing random processes with hysteresis, or writer monads for implementing tracing of complicated algorithms.

runRVarT :: (Lift n m, RandomSource m s) => RVarT n a -> s -> m aSource

"Runs" the monad.

nByteInteger :: Int -> RVarT m IntegerSource

A random variable evenly distributed over all unsigned integers from 0 to 2^(8*n)-1, inclusive.

nBitInteger :: Int -> RVarT m IntegerSource

A random variable evenly distributed over all unsigned integers from 0 to 2^n-1, inclusive.