- class Monad m => MonadRandom m where
- getRandomByte :: m Word8
- getRandomWord :: m Word64
- getRandomDouble :: m Double
- class Monad m => RandomSource m s where
- getRandomByteFrom :: s -> m Word8
- getRandomWordFrom :: s -> m Word64
- getRandomDoubleFrom :: s -> m Double
Documentation
class Monad m => MonadRandom m whereSource
A typeclass for monads with a chosen source of entropy. For example,
RVar
is such a monad - the source from which it is (eventually) sampled
is the only source from which a random variable is permitted to draw, so
when directly requesting entropy for a random variable these functions
are used.
The minimal definition is either getRandomByte
or getRandomWord
.
getRandomDouble
is defaulted in terms of getRandomWord
.
getRandomByte :: m Word8Source
Get a random uniformly-distributed byte.
getRandomWord :: m Word64Source
Get a random Word64
uniformly-distributed over the full range of the type.
getRandomDouble :: m DoubleSource
Get a random Double
uniformly-distributed over the interval [0,1)
MonadRandom (State PureMT) | |
MonadRandom (State StdGen) | |
MonadRandom (State PureMT) | |
MonadRandom (State StdGen) | |
MonadRandom (RVarT n) | |
Monad m => MonadRandom (StateT PureMT m) | |
Monad m => MonadRandom (StateT StdGen m) | |
Monad m => MonadRandom (StateT PureMT m) | |
Monad m => MonadRandom (StateT StdGen m) |
class Monad m => RandomSource m s whereSource
A source of entropy which can be used in the given monad.
The minimal definition is either getRandomByteFrom
or getRandomWordFrom
.
getRandomDoubleFrom
is defaulted in terms of getRandomWordFrom
getRandomByteFrom :: s -> m Word8Source
Get a random uniformly-distributed byte.
getRandomWordFrom :: s -> m Word64Source
Get a random Word64
uniformly-distributed over the full range of the type.
getRandomDoubleFrom :: s -> m DoubleSource
Get a random Double
uniformly-distributed over the interval [0,1)
RandomSource IO DevRandom | |
MonadRandom m => RandomSource m StdRandom | |
Monad m => RandomSource m (m Word64) | |
Monad m => RandomSource m (m Word8) | |
(Monad m, ModifyRef (TVar StdGen) m StdGen) => RandomSource m (TVar StdGen) | |
(Monad m, ModifyRef (IORef StdGen) m StdGen) => RandomSource m (IORef StdGen) | |
(Monad m, ModifyRef (TVar PureMT) m PureMT) => RandomSource m (TVar PureMT) | |
(Monad m, ModifyRef (IORef PureMT) m PureMT) => RandomSource m (IORef PureMT) | |
(Monad m, ModifyRef (STRef s StdGen) m StdGen) => RandomSource m (STRef s StdGen) | |
(Monad m1, ModifyRef (Ref m2 StdGen) m1 StdGen) => RandomSource m1 (Ref m2 StdGen) | |
(Monad m, ModifyRef (STRef s PureMT) m PureMT) => RandomSource m (STRef s PureMT) | |
(Monad m1, ModifyRef (Ref m2 PureMT) m1 PureMT) => RandomSource m1 (Ref m2 PureMT) |