- data Rand m a
- liftR :: PrimMonad m => m a -> Rand m a
- type RandIO a = Rand IO a
- asRandIO :: RandIO a -> RandIO a
- type RandST s a = Rand (ST s) a
- asRandST :: RandST s a -> RandST s a
- data Seed
- runRand :: Rand m a -> Gen (PrimState m) -> m a
- runWithSeed :: PrimMonad m => Seed -> Rand m a -> m a
- runWithVector :: (Vector v Word32, PrimMonad m) => Rand m a -> v Word32 -> m a
- runWithSystemRandom :: PrimMonad m => Rand m a -> IO a
- toRand :: PrimMonad m => (Gen (PrimState m) -> m a) -> Rand m a
- uniform :: (PrimMonad m, Variate a) => Rand m a
- uniformR :: (PrimMonad m, Variate a) => (a, a) -> Rand m a
- standard :: PrimMonad m => Rand m Double
- normal :: PrimMonad m => Double -> Double -> Rand m Double
- equiprobable :: PrimMonad m => [Rand m a] -> Rand m a
- choices :: PrimMonad m => [(Double, Rand m a)] -> Rand m a
- save :: PrimMonad m => Rand m Seed

# Random monad

Random monad for mwc-random package

runWithSeed :: PrimMonad m => Seed -> Rand m a -> m aSource

Run monad using seed

runWithVector :: (Vector v Word32, PrimMonad m) => Rand m a -> v Word32 -> m aSource

By creating seed from vector of values

runWithSystemRandom :: PrimMonad m => Rand m a -> IO aSource

Run monad using system random

# Random numbers generation

uniformR :: (PrimMonad m, Variate a) => (a, a) -> Rand m aSource

Uniformly distributed values in range

standard :: PrimMonad m => Rand m DoubleSource

Normally distributed variables with mean 0 and 1 standard deviation

# Combining monads

equiprobable :: PrimMonad m => [Rand m a] -> Rand m aSource

Randomly select from list of equiprobable random sources. List must be non-empty

choices :: PrimMonad m => [(Double, Rand m a)] -> Rand m aSource

Randomly select from list of weighted random sources. List must contain sources with positive weight. Elements with non-positive weight are discarded