Portability | portable |
---|---|

Stability | experimental |

Maintainer | alexey.skladnoy@gmail.com |

Safe Haskell | None |

This module provide monadic interface for `mwc-random`

package. It's just a thin wrapper and all work is done
`mwc-random`

.

- data Rand m a
- toRand :: PrimMonad m => (Gen (PrimState m) -> m a) -> 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
- runRand :: Rand m a -> Gen (PrimState m) -> m a
- runWithCreate :: PrimMonad m => Rand m a -> 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
- uniform :: (PrimMonad m, Variate a) => Rand m a
- uniformR :: (PrimMonad m, Variate a) => (a, a) -> Rand m a
- data Seed
- toSeed :: Vector v Word32 => v Word32 -> Seed
- fromSeed :: Seed -> Vector Word32
- save :: PrimMonad m => Rand m Seed

# Random monad

Random monad for mwc-random package

## Type syhnonims

## Running monad

runWithCreate :: PrimMonad m => Rand m a -> m aSource

Run monad using fixed seed

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