mwc-random 0.5.0.0 → 0.5.1.1
raw patch · 2 files changed
+12/−3 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ System.Random.MWC: type GenIO = Gen (PrimState IO)
+ System.Random.MWC: type GenST s = Gen (PrimState (ST s))
Files
- System/Random/MWC.hs +11/−2
- mwc-random.cabal +1/−1
System/Random/MWC.hs view
@@ -21,6 +21,8 @@ ( -- * Types Gen+ , GenIO+ , GenST , Seed , Variate(..) -- * Other distributions@@ -44,6 +46,7 @@ import Control.Exception (IOException, catch) import Control.Monad (ap, liftM, unless)+import Control.Monad.ST (ST) import Control.Monad.Primitive (PrimMonad, PrimState, unsafePrimToIO) import Data.Bits ((.&.), (.|.), xor) import Data.IORef (atomicModifyIORef, newIORef)@@ -210,6 +213,12 @@ -- | State of the pseudo-random number generator. newtype Gen s = Gen (M.MVector s Word32) +-- | A shorter name for PRNG state in the IO monad.+type GenIO = Gen (PrimState IO)++-- | A shorter name for PRNG state in the ST monad.+type GenST s = Gen (PrimState (ST s))+ ioff, coff :: Int ioff = 256 coff = 257@@ -403,8 +412,8 @@ then return x else loop blocks = let f = exp (-0.5 * r * r)- in (`I.snoc` 0) . I.cons (v/f) . I.cons r . I.take 126 .- I.unfoldr go $! T r f+ in (`I.snoc` 0) . I.cons (v/f) . I.cons r .+ I.unfoldrN 126 go $! T r f where go (T b g) = let !u = T h (exp (-0.5 * h * h)) h = sqrt (-2 * log (v / b + g))
mwc-random.cabal view
@@ -1,5 +1,5 @@ name: mwc-random-version: 0.5.0.0+version: 0.5.1.1 synopsis: Fast, high quality pseudo random number generation description: This package contains code for generating high quality random