random-fu-0.0.0.2: Random number generationSource codeContentsIndex
Data.Random.Source.PureMT
Synopsis
getRandomWordsFromMTRef :: ModifyRef sr m PureMT => sr -> Int -> m [Word64]
getRandomWordsFromMTState :: MonadState PureMT m => Int -> m [Word64]
Documentation
getRandomWordsFromMTRef :: ModifyRef sr m PureMT => sr -> Int -> m [Word64]Source

Given a mutable reference to a PureMT generator, we can make a RandomSource usable in any monad in which the reference can be modified.

For example, if x :: TVar PureMT, getRandomWordsFromMTRef x can be used as a RandomSource in IO, STM, or any monad which is an instance of MonadIO.

getRandomWordsFromMTState :: MonadState PureMT m => Int -> m [Word64]Source
Similarly, getRandomWordsFromMTState x can be used in any "state" monad in the mtl sense whose state is a PureMT generator. Additionally, the standard mtl state monads have MonadRandom instances which do precisely that, allowing an easy conversion of RVars and other Distribution instances to "pure" random variables.
Produced by Haddock version 2.4.2