pcg-random 0.1.3.7 → 0.1.4.0
raw patch · 7 files changed
+30/−15 lines, 7 filesdep ~primitivedep ~random
Dependency ranges changed: primitive, random
Files
- pcg-random.cabal +4/−4
- src/System/Random/PCG.hs +2/−2
- src/System/Random/PCG/Class.hs +2/−1
- src/System/Random/PCG/Fast.hs +11/−2
- src/System/Random/PCG/Fast/Pure.hs +7/−2
- src/System/Random/PCG/Pure.hs +2/−2
- src/System/Random/PCG/Single.hs +2/−2
pcg-random.cabal view
@@ -1,5 +1,5 @@ name: pcg-random-version: 0.1.3.7+version: 0.1.4.0 synopsis: Haskell bindings to the PCG random number generator. description: PCG is a family of simple fast space-efficient statistically good@@ -31,7 +31,7 @@ custom-setup setup-depends: base >= 4 && <5,- Cabal,+ Cabal < 4.0, cabal-doctest >= 1 && <1.1 source-repository head@@ -52,8 +52,8 @@ other-extensions: BangPatterns, CPP, ForeignFunctionInterface build-depends: base >=4.3 && < 5,- primitive >=0.4 && < 0.8,- random >=1.0 && < 2.0,+ primitive >=0.7 && < 0.9,+ random >=1.2 && < 2.0, bytestring, entropy default-language: Haskell2010
src/System/Random/PCG.hs view
@@ -254,7 +254,7 @@ {-# INLINE uniform1B #-} instance RandomGen FrozenGen where- next s = unsafeDupablePerformIO $ do+ genWord64 s = unsafeDupablePerformIO $ do p <- malloc poke p s w1 <- pcg32_random_r p@@ -262,7 +262,7 @@ s' <- peek p free p return (wordsTo64Bit w1 w2, s')- {-# INLINE next #-}+ {-# INLINE genWord64 #-} split s = unsafeDupablePerformIO $ do p <- malloc
src/System/Random/PCG/Class.hs view
@@ -50,6 +50,7 @@ #include "MachDeps.h" #endif +import qualified Data.Kind import Control.Monad import Data.Bits import Data.ByteString (useAsCString)@@ -449,7 +450,7 @@ -- Type family for fixed size integrals. For signed data types it's -- its unsigned couterpart with same size and for unsigned data types -- it's same type-type family Unsigned a :: *+type family Unsigned a :: Data.Kind.Type type instance Unsigned Int8 = Word8 type instance Unsigned Int16 = Word16
src/System/Random/PCG/Fast.hs view
@@ -223,15 +223,24 @@ {-# INLINE uniform1B #-} instance RandomGen FrozenGen where- next s = unsafeDupablePerformIO $ do+ genWord32 s = unsafeDupablePerformIO $ do p <- malloc poke p s+ w <- pcg32f_random_r p+ s' <- peek p+ free p+ return (w, s')+ {-# INLINE genWord32 #-}++ genWord64 s = unsafeDupablePerformIO $ do+ p <- malloc+ poke p s w1 <- pcg32f_random_r p w2 <- pcg32f_random_r p s' <- peek p free p return (wordsTo64Bit w1 w2, s')- {-# INLINE next #-}+ {-# INLINE genWord64 #-} split s = unsafeDupablePerformIO $ do p <- malloc
src/System/Random/PCG/Fast/Pure.hs view
@@ -253,11 +253,16 @@ {-# INLINE uniform1B #-} instance RandomGen FrozenGen where- next (F s) = (wordsTo64Bit w1 w2, F s'')+ genWord32 (F s) = (w, F s') where+ P s' w = pair s+ {-# INLINE genWord32 #-}++ genWord64 (F s) = (wordsTo64Bit w1 w2, F s'')+ where P s' w1 = pair s P s'' w2 = pair s'- {-# INLINE next #-}+ {-# INLINE genWord64 #-} split (F s) = (mk w1 w2, mk w3 w4) where
src/System/Random/PCG/Pure.hs view
@@ -303,11 +303,11 @@ {-# INLINE uniform1B #-} instance RandomGen FrozenGen where- next (SetSeq s inc) = (wordsTo64Bit w1 w2, SetSeq s'' inc)+ genWord64 (SetSeq s inc) = (wordsTo64Bit w1 w2, SetSeq s'' inc) where Pair s' w1 = pair (SetSeq s inc) Pair s'' w2 = pair (SetSeq s' inc)- {-# INLINE next #-}+ {-# INLINE genWord64 #-} split (SetSeq s inc) = (SetSeq s4 inc, mk w1 w2 w3 w4) where
src/System/Random/PCG/Single.hs view
@@ -221,7 +221,7 @@ instance RandomGen FrozenGen where- next s = unsafeDupablePerformIO $ do+ genWord64 s = unsafeDupablePerformIO $ do p <- malloc poke p s w1 <- pcg32s_random_r p@@ -229,7 +229,7 @@ s' <- peek p free p return (wordsTo64Bit w1 w2, s')- {-# INLINE next #-}+ {-# INLINE genWord64 #-} split s = unsafeDupablePerformIO $ do p <- malloc