rng-utils-0.2: RNG within an MVar for convenient concurrent use

Stabilityexperimental
MaintainerOzgun Ataman <ozgun.ataman@soostone.com>
Safe HaskellNone

Data.RNG

Contents

Description

Convenience thread-safe wrapper around mwc-random library for practical supply of random numbers in a concurrent environment.

Synopsis

Documentation

data RNG Source

High speed, mutable random number generator state

mkRNG :: IO RNGSource

Create a new RNG in the IO monad using withSystemRandom.

packRNG :: GenIO -> IO RNGSource

Pack your own rng into the RNG type.

withRNG :: RNG -> (GenIO -> IO a) -> IO aSource

Perform given action, mutating the RNG state underneath.

randomToken :: Int -> RNG -> IO ByteStringSource

Generates a random salt of given length

Re-export MWC for convenience.