Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

createSystemRandom #22

Merged
merged 1 commit into from Sep 11, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions System/Random/MWC.hs
Expand Up @@ -69,6 +69,7 @@ module System.Random.MWC
, create
, initialize
, withSystemRandom
, createSystemRandom

-- ** Type helpers
-- $typehelp
Expand Down Expand Up @@ -441,6 +442,11 @@ withSystemRandom act = do
warned = unsafePerformIO $ newIORef False
{-# NOINLINE warned #-}

-- | Seed a PRNG with data from the system's fast source of pseudo-random
-- numbers. All the caveats of 'withSystemRandom' apply here as well.
createSystemRandom :: IO GenIO
createSystemRandom = withSystemRandom (return :: GenIO -> IO GenIO)

-- | Compute the next index into the state pool. This is simply
-- addition modulo 256.
nextIndex :: Integral a => a -> Int
Expand Down