Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
MCSP.System.Random.Generate
Description
Apply generators to the Random
monad.
Default Generator
generate :: Random a -> IO a Source #
Generate value using a random seed with the Standard PCG Generator.
>>>
import MCSP.System.Random.Monad (liftRandom)
>>>
import Data.Function (id)
>>>
import System.Random.PCG.Class (uniform1)
>>>
generate (liftRandom (uniform1 id))
...
generateWith :: Seed -> Random a -> a Source #
Use given seed to generate value using the Standard PCG generator.
>>>
import MCSP.System.Random.Monad (liftRandom)
>>>
import Data.Function (id)
>>>
import System.Random.PCG.Class (uniform1)
>>>
generateWith (100,200) (liftRandom (uniform1 id))
717541362
Faster Generator
generateFast :: Random a -> IO a Source #
Generate value using a random seed with the Fast PCG Generator.
>>>
import MCSP.System.Random.Monad (liftRandom)
>>>
import Data.Function (id)
>>>
import System.Random.PCG.Class (uniform1)
>>>
generateFast (liftRandom (uniform1 id))
...
generateFastWith :: Seed -> Random a -> a Source #
Use given seed to generate value using the Fast PCG generator.
>>>
import MCSP.System.Random.Monad (liftRandom)
>>>
import Data.Function (id)
>>>
import System.Random.PCG.Class (uniform1)
>>>
generateFastWith (100,200) (liftRandom (uniform1 id))
77824
Standard Seed
randomSeed :: IO Seed Source #
Generate a new random seed.
>>>
randomSeed
...