splitmix 0.1 → 0.1.0.1
raw patch · 4 files changed
+29/−3 lines, 4 filesdep ~basedep ~time
Dependency ranges changed: base, time
Files
- Changelog.md +5/−0
- splitmix.cabal +3/−3
- src/System/Random/SplitMix.hs +10/−0
- src/System/Random/SplitMix32.hs +11/−0
Changelog.md view
@@ -1,3 +1,8 @@+# 0.1.0.1++- Add `INLINEABLE` pragmas to `bitmaskWithRejection*` functions+- Support GHC-9.0+ # 0.1 - Drop `random` dependency unconditionally.
splitmix.cabal view
@@ -1,6 +1,6 @@ cabal-version: >=1.10 name: splitmix-version: 0.1+version: 0.1.0.1 synopsis: Fast Splittable PRNG description: Pure Haskell implementation of SplitMix described in@@ -72,9 +72,9 @@ -- ghc-options: -fplugin=DumpCore -fplugin-opt DumpCore:core-html build-depends:- base >=4.3 && <4.15+ base >=4.3 && <4.16 , deepseq >=1.3.0.0 && <1.5- , time >=1.2.0.3 && <1.10+ , time >=1.2.0.3 && <1.11 if flag(optimised-mixer) cpp-options: -DOPTIMISED_MIX32=1
src/System/Random/SplitMix.hs view
@@ -289,10 +289,14 @@ -- | /Bitmask with rejection/ method of generating subrange of 'Word32'. --+-- @bitmaskWithRejection32 w32@ generates random numbers in closed-open+-- range of @[0, w32)@.+-- -- @since 0.0.3 bitmaskWithRejection32 :: Word32 -> SMGen -> (Word32, SMGen) bitmaskWithRejection32 0 = error "bitmaskWithRejection32 0" bitmaskWithRejection32 n = bitmaskWithRejection32' (n - 1)+{-# INLINEABLE bitmaskWithRejection32 #-} -- | /Bitmask with rejection/ method of generating subrange of 'Word64'. --@@ -306,9 +310,13 @@ bitmaskWithRejection64 :: Word64 -> SMGen -> (Word64, SMGen) bitmaskWithRejection64 0 = error "bitmaskWithRejection64 0" bitmaskWithRejection64 n = bitmaskWithRejection64' (n - 1)+{-# INLINEABLE bitmaskWithRejection64 #-} -- | /Bitmask with rejection/ method of generating subrange of 'Word32'. --+-- @bitmaskWithRejection32' w32@ generates random numbers in closed-closed+-- range of @[0, w32]@.+-- -- @since 0.0.4 bitmaskWithRejection32' :: Word32 -> SMGen -> (Word32, SMGen) bitmaskWithRejection32' range = go where@@ -318,6 +326,7 @@ in if x' > range then go g' else (x', g')+{-# INLINEABLE bitmaskWithRejection32' #-} -- | /Bitmask with rejection/ method of generating subrange of 'Word64'. --@@ -336,6 +345,7 @@ in if x' > range then go g' else (x', g')+{-# INLINEABLE bitmaskWithRejection64' #-} -------------------------------------------------------------------------------
src/System/Random/SplitMix32.hs view
@@ -271,9 +271,14 @@ ------------------------------------------------------------------------------- -- | /Bitmask with rejection/ method of generating subrange of 'Word32'.+--+-- @bitmaskWithRejection32 w32@ generates random numbers in closed-open+-- range of @[0, w32)@.+-- bitmaskWithRejection32 :: Word32 -> SMGen -> (Word32, SMGen) bitmaskWithRejection32 0 = error "bitmaskWithRejection32 0" bitmaskWithRejection32 n = bitmaskWithRejection32' (n - 1)+{-# INLINEABLE bitmaskWithRejection32 #-} -- | /Bitmask with rejection/ method of generating subrange of 'Word64'. --@@ -286,9 +291,13 @@ bitmaskWithRejection64 :: Word64 -> SMGen -> (Word64, SMGen) bitmaskWithRejection64 0 = error "bitmaskWithRejection64 0" bitmaskWithRejection64 n = bitmaskWithRejection64' (n - 1)+{-# INLINEABLE bitmaskWithRejection64 #-} -- | /Bitmask with rejection/ method of generating subrange of 'Word32'. --+-- @bitmaskWithRejection32' w32@ generates random numbers in closed-closed+-- range of @[0, w32]@.+-- -- @since 0.0.4 bitmaskWithRejection32' :: Word32 -> SMGen -> (Word32, SMGen) bitmaskWithRejection32' range = go where@@ -298,6 +307,7 @@ in if x' > range then go g' else (x', g')+{-# INLINEABLE bitmaskWithRejection32' #-} -- | /Bitmask with rejection/ method of generating subrange of 'Word64'. --@@ -316,6 +326,7 @@ in if x' > range then go g' else (x', g')+{-# INLINEABLE bitmaskWithRejection64' #-} ------------------------------------------------------------------------------- -- Initialisation