random-fu-0.0.3: Random number generationSource codeContentsIndex
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
type RVar = RVarT Identity
runRVar :: RandomSource m s => RVar a -> s -> m a
data RVarT n a
runRVarT :: (Lift n m, RandomSource m s) => RVarT n a -> s -> m a
nByteInteger :: Int -> RVarT m Integer
nBitInteger :: Int -> RVarT m Integer
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.
show/hide Instances
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.
Produced by Haddock version 2.4.2