- getRandomWordFromMTRef :: ModifyRef sr m PureMT => sr -> m Word64
- getRandomByteFromMTRef :: (Monad m, ModifyRef sr m PureMT) => sr -> m Word8
- getRandomDoubleFromMTRef :: (Monad m, ModifyRef sr m PureMT) => sr -> m Double
- getRandomWordFromMTState :: MonadState PureMT m => m Word64
- getRandomByteFromMTState :: MonadState PureMT m => m Word8
- getRandomDoubleFromMTState :: MonadState PureMT m => m Double
For example, if
x :: TVar PureMT,
getRandomWordFromMTRef x can be
used as a
STM, or any monad which is an instance
MonadIO. These functions can also be used to implement additional
RandomSource instances for mutable references to
getRandomWordFromMTState x can be used in any "state"
monad in the mtl sense whose state is a
Additionally, the standard mtl state monads have
which do precisely that, allowing an easy conversion of
Distribution instances to "pure" random variables (e.g., by
runState . sample :: Distribution d t => d t -> PureMT -> (t, PureMT).
PureMT in the type there can be replaced by
StdGen or anything else
MonadRandom (State s) => s).