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

CopyrightSoostone Inc, Snap Framework Authors
LicenseBSD3
MaintainerOzgun Ataman <ozgun.ataman@soostone.com>
Stabilityexperimental
Safe HaskellNone
LanguageHaskell98

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 RNG Source

Create a new RNG in the IO monad using withSystemRandom.

seedRNG :: [Word32] -> IO RNG Source

Create a new RNG with a user-specified seed.

packRNG :: GenIO -> IO RNG Source

Pack your own rng into the RNG type.

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

Perform given action, mutating the RNG state underneath.

randomToken :: Int -> RNG -> IO ByteString Source

Generates a random salt of given length

Re-export MWC for convenience.