Commits

Michael Snoyman committed 255db3d

createSystemRandom

Comments (0)

Files changed (1)

System/Random/MWC.hs

     , create
     , initialize
     , withSystemRandom
+    , createSystemRandom
 
     -- ** Type helpers
     -- $typehelp
     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