packages feed

pcg-random 0.1.0.1 → 0.1.1.0

raw patch · 8 files changed

+294/−21 lines, 8 files

Files

CHANGELOG.md view
@@ -1,3 +1,10 @@+### 0.1.1.0++* Add uniformB, a function to generate a bounded random number in [0,b)+  range. This preforms significantly faster than uniformR (0,b-1).++* Add type specific versions for uniformR and uniformB.+ ### 0.1.0.1  * Fix bug when dealing with `Word` and `Int` types.
+ c/pcg-advance-128.c view
@@ -0,0 +1,64 @@+/*+ * PCG Random Number Generation for C.+ *+ * Copyright 2014 Melissa O'Neill <oneill@pcg-random.org>+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ *     http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ *+ * For additional information about the PCG random number generation scheme,+ * including its license and other licensing options, visit+ *+ *       http://www.pcg-random.org+ */++/*+ * This code is derived from the canonical C++ PCG implementation, which+ * has many additional features and is preferable if you can use C++ in+ * your project.+ *+ * Repetative C code is derived using C preprocessor metaprogramming+ * techniques.+ */++#include "pcg_variants.h"++/* Multi-step advance functions (jump-ahead, jump-back)+ *+ * The method used here is based on Brown, "Random Number Generation+ * with Arbitrary Stride,", Transactions of the American Nuclear+ * Society (Nov. 1994).  The algorithm is very similar to fast+ * exponentiation.+ *+ * Even though delta is an unsigned integer, we can pass a+ * signed integer to go backwards, it just goes "the long way round".+ */++#if PCG_HAS_128BIT_OPS+pcg128_t pcg_advance_lcg_128(pcg128_t state, pcg128_t delta, pcg128_t cur_mult,+                             pcg128_t cur_plus)+{+    pcg128_t acc_mult = 1u;+    pcg128_t acc_plus = 0u;+    while (delta > 0) {+        if (delta & 1) {+            acc_mult *= cur_mult;+            acc_plus = acc_plus * cur_mult + cur_plus;+        }+        cur_plus = (cur_mult + 1) * cur_plus;+        cur_mult *= cur_mult;+        delta /= 2;+    }+    return acc_mult * state + acc_plus;+}+#endif+
pcg-random.cabal view
@@ -1,10 +1,11 @@ name:                pcg-random-version:             0.1.0.1+version:             0.1.1.0 synopsis:            Haskell bindings to the PCG random number generator. description:   PCG is a family of simple fast space-efficient statistically good   algorithms for random number generation with better-than-typical-  cryptographic security.+  cryptographic security. See http://http://www.pcg-random.org for more+  information.   .   This library implements bindings to the standard C implementation.   This includes the standard, unique, fast and single variants in the@@ -23,7 +24,7 @@ maintainer:          c.chalmers@me.com Homepage:            http://github.com/cchalmers/pcg-random Bug-reports:         http://github.com/cchalmers/pcg-random/issues-copyright:           (c) 2014. Christopher Chalmers <c.chalmers@me.com>+copyright:           (c) 2014-2015. Christopher Chalmers <c.chalmers@me.com> category:            System build-type:          Simple cabal-version:       >=1.10@@ -55,6 +56,7 @@     -std=c99 -fPIC    c-sources:+    c/pcg-advance-128.c     c/pcg-advance-64.c     c/pcg-global-64.c     c/pcg-output-64.c
src/System/Random/PCG.hs view
@@ -11,7 +11,7 @@ -------------------------------------------------------------------- -- | -- Module     : System.Random.PCG--- Copyright  : Copyright (c) 2014, Christopher Chalmers <c.chalmers@me.com>+-- Copyright  : Copyright (c) 2014-2015, Christopher Chalmers <c.chalmers@me.com> -- License    : BSD3 -- Maintainer : Christopher Chalmers <c.chalmers@me.com> -- Stability  : experimental@@ -47,9 +47,20 @@   , save, restore, seed, initFrozen      -- * Type restricted versions+    -- ** uniform   , uniformW8, uniformW16, uniformW32, uniformW64   , uniformI8, uniformI16, uniformI32, uniformI64   , uniformF, uniformD, uniformBool++    -- ** uniformR+  , uniformRW8, uniformRW16, uniformRW32, uniformRW64+  , uniformRI8, uniformRI16, uniformRI32, uniformRI64+  , uniformRF, uniformRD, uniformRBool++    -- ** uniformB+  , uniformBW8, uniformBW16, uniformBW32, uniformBW64+  , uniformBI8, uniformBI16, uniformBI32, uniformBI64+  , uniformBF, uniformBD, uniformBBool   ) where  import Data.Data@@ -211,8 +222,8 @@ foreign import ccall unsafe "pcg_setseq_64_xsh_rr_32_random_r"   pcg32_random_r :: Ptr FrozenGen -> IO Word32 --- foreign import ccall unsafe "pcg_setseq_64_xsh_rr_32_boundedrand_r"---   pcg32_boundedrand_r :: Ptr FrozenGen -> Word32 -> IO Word32+foreign import ccall unsafe "pcg_setseq_64_xsh_rr_32_boundedrand_r"+  pcg32_boundedrand_r :: Ptr FrozenGen -> Word32 -> IO Word32  foreign import ccall unsafe "pcg_setseq_64_advance_r"   pcg32_advance_r :: Ptr FrozenGen -> Word64 -> IO ()@@ -230,6 +241,9 @@     w2 <- pcg32_random_r p     return $ f w1 w2   {-# INLINE uniform2 #-}++  uniform1B f b (Gen p) = unsafePrimToPrim $ f <$> pcg32_boundedrand_r p b+  {-# INLINE uniform1B #-}  instance RandomGen FrozenGen where   next s = unsafeDupablePerformIO $ do
src/System/Random/PCG/Class.hs view
@@ -7,7 +7,7 @@ {-# LANGUAGE UnboxedTuples         #-} -- | -- Module     : System.Random.PCG.Class--- Copyright  : Copyright (c) 2014, Christopher Chalmers <c.chalmers@me.com>+-- Copyright  : Copyright (c) 2014-2015, Christopher Chalmers <c.chalmers@me.com> -- License    : BSD3 -- Maintainer : Christopher Chalmers <c.chalmers@me.com> -- Stability  : experimental@@ -22,10 +22,21 @@   , Variate (..)      -- * Type restricted versions+    -- ** uniform   , uniformW8, uniformW16, uniformW32, uniformW64   , uniformI8, uniformI16, uniformI32, uniformI64   , uniformF, uniformD, uniformBool +    -- ** uniformR+  , uniformRW8, uniformRW16, uniformRW32, uniformRW64+  , uniformRI8, uniformRI16, uniformRI32, uniformRI64+  , uniformRF, uniformRD, uniformRBool++    -- ** uniformB+  , uniformBW8, uniformBW16, uniformBW32, uniformBW64+  , uniformBI8, uniformBI16, uniformBI32, uniformBI64+  , uniformBF, uniformBD, uniformBBool+    -- * Utilities   , Unsigned   , wordsTo64Bit@@ -56,6 +67,7 @@ class Monad m => Generator g m where   uniform1 :: (Word32 -> a) -> g -> m a   uniform2 :: (Word32 -> Word32 -> a) -> g -> m a+  uniform1B :: Integral a => (Word32 -> a) -> Word32 -> g -> m a  class Variate a where   -- | Generate a uniformly distributed random vairate.@@ -73,6 +85,12 @@   --   * Use (a,b] range for floating types.   uniformR :: Generator g m => (a,a) -> g -> m a +  -- | Generate a uniformly distributed random vairate in the range+  --   [0,b). For integral types the bound must be less than the max bound+  --   of 'Word32' (4294967295). Behaviour is undefined for negative+  --   bounds.+  uniformB :: Generator g m => a -> g -> m a+ ------------------------------------------------------------------------ -- Variate instances ------------------------------------------------------------------------@@ -82,48 +100,64 @@   {-# INLINE uniform  #-}   uniformR a g = uniformRange a g   {-# INLINE uniformR #-}+  uniformB b g = uniform1B fromIntegral (fromIntegral b) g+  {-# INLINE uniformB #-}  instance Variate Int16 where   uniform  = uniform1 fromIntegral   {-# INLINE uniform  #-}   uniformR a g = uniformRange a g   {-# INLINE uniformR #-}+  uniformB b g = uniform1B fromIntegral (fromIntegral b) g+  {-# INLINE uniformB #-}  instance Variate Int32 where   uniform = uniform1 fromIntegral   {-# INLINE uniform  #-}   uniformR a g = uniformRange a g   {-# INLINE uniformR #-}+  uniformB b g = uniform1B fromIntegral (fromIntegral b) g+  {-# INLINE uniformB #-}  instance Variate Int64 where   uniform = uniform2 wordsTo64Bit   {-# INLINE uniform  #-}   uniformR a g = uniformRange a g   {-# INLINE uniformR #-}+  uniformB b g = uniform1B fromIntegral (fromIntegral b) g+  {-# INLINE uniformB #-}  instance Variate Word8 where   uniform = uniform1 fromIntegral   {-# INLINE uniform  #-}   uniformR a g = uniformRange a g   {-# INLINE uniformR #-}+  uniformB b g = uniform1B fromIntegral (fromIntegral b) g+  {-# INLINE uniformB #-}  instance Variate Word16 where   uniform = uniform1 fromIntegral   {-# INLINE uniform  #-}   uniformR a g = uniformRange a g   {-# INLINE uniformR #-}+  uniformB b g = uniform1B fromIntegral (fromIntegral b) g+  {-# INLINE uniformB #-}  instance Variate Word32 where   uniform = uniform1 fromIntegral   {-# INLINE uniform  #-}   uniformR a g = uniformRange a g   {-# INLINE uniformR #-}+  uniformB b g = uniform1B fromIntegral (fromIntegral b) g+  {-# INLINE uniformB #-}  instance Variate Word64 where   uniform = uniform2 wordsTo64Bit   {-# INLINE uniform  #-}   uniformR a g = uniformRange a g   {-# INLINE uniformR #-}+  uniformB b g = uniform1B fromIntegral (fromIntegral b) g+  {-# INLINE uniformB #-}  instance Variate Bool where   uniform = uniform1 wordToBool@@ -133,18 +167,27 @@   uniformR (True,True)   _ = return True   uniformR (True,False)  g = uniform g   {-# INLINE uniformR #-}+  uniformB False _ = return False+  uniformB _     g = uniform g+  {-# INLINE uniformB #-}  instance Variate Float where   uniform = uniform1 wordToFloat   {-# INLINE uniform  #-}   uniformR (x1,x2) = uniform1 (\w -> x1 + (x2-x1) * wordToFloat w)   {-# INLINE uniformR #-}+  -- subtract 2**(-33) to go from (0,b] to [0,b) (I think)+  uniformB b g = (subtract 1.16415321826934814453125e-10) `liftM` uniformR (0,b) g+  {-# INLINE uniformB #-}  instance Variate Double where   uniform = uniform2 wordsToDouble   {-# INLINE uniform  #-}   uniformR (x1,x2) = uniform2 (\w1 w2 -> x1 + (x2-x1) * wordsToDouble w1 w2)   {-# INLINE uniformR #-}+  -- subtract 2**(-53) to go from (0,b] to [0,b) (I think)+  uniformB b g = (subtract 1.1102230246251565404236316680908203125e-16) `liftM` uniformR (0,b) g+  {-# INLINE uniformB #-}  instance Variate Word where #if WORD_SIZE_IN_BITS < 64@@ -155,6 +198,8 @@   {-# INLINE uniform  #-}   uniformR a g = uniformRange a g   {-# INLINE uniformR #-}+  uniformB b g = uniform1B fromIntegral (fromIntegral b) g+  {-# INLINE uniformB #-}  instance Variate Int where #if WORD_SIZE_IN_BITS < 64@@ -165,12 +210,16 @@   {-# INLINE uniform  #-}   uniformR a g = uniformRange a g   {-# INLINE uniformR #-}+  uniformB b g = uniform1B fromIntegral (fromIntegral b) g+  {-# INLINE uniformB #-}  instance (Variate a, Variate b) => Variate (a,b) where   uniform g = (,) `liftM` uniform g `ap` uniform g   {-# INLINE uniform  #-}   uniformR ((x1,y1),(x2,y2)) g = (,) `liftM` uniformR (x1,x2) g `ap` uniformR (y1,y2) g   {-# INLINE uniformR #-}+  uniformB (b1,b2) g = (,) `liftM` uniformB b1 g `ap` uniformB b2 g+  {-# INLINE uniformB #-}  instance (Variate a, Variate b, Variate c) => Variate (a,b,c) where   uniform g = (,,) `liftM` uniform g `ap` uniform g `ap` uniform g@@ -178,6 +227,8 @@   uniformR ((x1,y1,z1),(x2,y2,z2)) g =     (,,) `liftM` uniformR (x1,x2) g `ap` uniformR (y1,y2) g `ap` uniformR (z1,z2) g   {-# INLINE uniformR #-}+  uniformB (b1,b2,b3) g = (,,) `liftM` uniformB b1 g `ap` uniformB b2 g `ap` uniformB b3 g+  {-# INLINE uniformB #-}  instance (Variate a, Variate b, Variate c, Variate d) => Variate (a,b,c,d) where   uniform g = (,,,) `liftM` uniform g `ap` uniform g `ap` uniform g `ap` uniform g@@ -186,11 +237,15 @@     (,,,) `liftM` uniformR (x1,x2) g `ap` uniformR (y1,y2) g `ap`                   uniformR (z1,z2) g `ap` uniformR (t1,t2) g   {-# INLINE uniformR #-}+  uniformB (b1,b2,b3,b4) g = (,,,) `liftM` uniformB b1 g `ap` uniformB b2 g `ap` uniformB b3 g `ap` uniformB b4 g+  {-# INLINE uniformB #-}  ------------------------------------------------------------------------ -- Type restricted versions ------------------------------------------------------------------------ +-- uniform -------------------------------------------------------------+ uniformI8 :: Generator g m => g -> m Int8 uniformI8 = uniform {-# INLINE uniformI8 #-}@@ -234,6 +289,98 @@ uniformD :: Generator g m => g -> m Double uniformD = uniform {-# INLINE uniformD #-}++-- uniformR ------------------------------------------------------------++uniformRI8 :: Generator g m => (Int8, Int8) -> g -> m Int8+uniformRI8 = uniformR+{-# INLINE uniformRI8 #-}++uniformRI16 :: Generator g m => (Int16, Int16) -> g -> m Int16+uniformRI16 = uniformR+{-# INLINE uniformRI16 #-}++uniformRI32 :: Generator g m => (Int32, Int32) -> g -> m Int32+uniformRI32 = uniformR+{-# INLINE uniformRI32 #-}++uniformRI64 :: Generator g m => (Int64, Int64) -> g -> m Int64+uniformRI64 = uniformR+{-# INLINE uniformRI64 #-}++uniformRW8 :: Generator g m => (Word8, Word8) -> g -> m Word8+uniformRW8 = uniformR+{-# INLINE uniformRW8 #-}++uniformRW16 :: Generator g m => (Word16, Word16) -> g -> m Word16+uniformRW16 = uniformR+{-# INLINE uniformRW16 #-}++uniformRW32 :: Generator g m => (Word32, Word32) -> g -> m Word32+uniformRW32 = uniformR+{-# INLINE uniformRW32 #-}++uniformRW64 :: Generator g m => (Word64, Word64) -> g -> m Word64+uniformRW64 = uniformR+{-# INLINE uniformRW64 #-}++uniformRBool :: Generator g m => (Bool, Bool) -> g -> m Bool+uniformRBool = uniformR+{-# INLINE uniformRBool #-}++uniformRF :: Generator g m => (Float, Float) -> g -> m Float+uniformRF = uniformR+{-# INLINE uniformRF #-}++uniformRD :: Generator g m => (Double, Double) -> g -> m Double+uniformRD = uniformR+{-# INLINE uniformRD #-}++-- uniformB ------------------------------------------------------------++uniformBI8 :: Generator g m => Int8 -> g -> m Int8+uniformBI8 = uniformB+{-# INLINE uniformBI8 #-}++uniformBI16 :: Generator g m => Int16 -> g -> m Int16+uniformBI16 = uniformB+{-# INLINE uniformBI16 #-}++uniformBI32 :: Generator g m => Int32 -> g -> m Int32+uniformBI32 = uniformB+{-# INLINE uniformBI32 #-}++uniformBI64 :: Generator g m => Int64 -> g -> m Int64+uniformBI64 = uniformB+{-# INLINE uniformBI64 #-}++uniformBW8 :: Generator g m => Word8 -> g -> m Word8+uniformBW8 = uniformB+{-# INLINE uniformBW8 #-}++uniformBW16 :: Generator g m => Word16 -> g -> m Word16+uniformBW16 = uniformB+{-# INLINE uniformBW16 #-}++uniformBW32 :: Generator g m => Word32 -> g -> m Word32+uniformBW32 = uniformB+{-# INLINE uniformBW32 #-}++uniformBW64 :: Generator g m => Word64 -> g -> m Word64+uniformBW64 = uniformB+{-# INLINE uniformBW64 #-}++uniformBBool :: Generator g m => Bool -> g -> m Bool+uniformBBool = uniformB+{-# INLINE uniformBBool #-}++uniformBF :: Generator g m => Float -> g -> m Float+uniformBF = uniformB+{-# INLINE uniformBF #-}++uniformBD :: Generator g m => Double -> g -> m Double+uniformBD = uniformB+{-# INLINE uniformBD #-}  ------------------------------------------------------------------------ -- Utilities
src/System/Random/PCG/Fast.hs view
@@ -11,7 +11,7 @@ #endif -- | -- Module     : System.Random.PCG.Fast--- Copyright  : Copyright (c) 2014, Christopher Chalmers <c.chalmers@me.com>+-- Copyright  : Copyright (c) 2014-2015, Christopher Chalmers <c.chalmers@me.com> -- License    : BSD3 -- Maintainer : Christopher Chalmers <c.chalmers@me.com> -- Stability  : experimental@@ -48,9 +48,20 @@   , FrozenGen, save, restore, seed, initFrozen      -- * Type restricted versions+    -- ** uniform   , uniformW8, uniformW16, uniformW32, uniformW64   , uniformI8, uniformI16, uniformI32, uniformI64   , uniformF, uniformD, uniformBool++    -- ** uniformR+  , uniformRW8, uniformRW16, uniformRW32, uniformRW64+  , uniformRI8, uniformRI16, uniformRI32, uniformRI64+  , uniformRF, uniformRD, uniformRBool++    -- ** uniformB+  , uniformBW8, uniformBW16, uniformBW32, uniformBW64+  , uniformBI8, uniformBI16, uniformBI32, uniformBI64+  , uniformBF, uniformBD, uniformBBool   ) where  import Control.Applicative@@ -145,11 +156,6 @@ createSystemRandom :: IO GenIO createSystemRandom = withSystemRandom (return :: GenIO -> IO GenIO) --- -- | Generate a uniform 'Word32' bounded by the given bound.--- uniformB :: PrimMonad m => Word32 -> Gen (PrimState m) -> m Word32--- uniformB u (Gen p) = unsafePrimToPrim $ pcg32f_boundedrand_r p u--- {-# INLINE uniformB #-}- -- | Advance the given generator n steps in log(n) time. (Note that a --   \"step\" is a single random 32-bit (or less) 'Variate'. Data types --   such as 'Double' or 'Word64' require two \"steps\".)@@ -185,8 +191,8 @@ foreign import ccall unsafe "pcg_mcg_64_xsh_rs_32_random_r"   pcg32f_random_r :: Ptr FrozenGen -> IO Word32 --- foreign import ccall unsafe "pcg_mcg_64_xsh_rs_32_boundedrand_r"---   pcg32f_boundedrand_r :: Ptr FrozenGen -> Word32 -> IO Word32+foreign import ccall unsafe "pcg_mcg_64_xsh_rs_32_boundedrand_r"+  pcg32f_boundedrand_r :: Ptr FrozenGen -> Word32 -> IO Word32  foreign import ccall unsafe "pcg_mcg_64_advance_r"   pcg32f_advance_r :: Ptr FrozenGen -> Word64 -> IO ()@@ -204,6 +210,9 @@     w2 <- pcg32f_random_r p     return $ f w1 w2   {-# INLINE uniform2 #-}++  uniform1B f b (Gen p) = unsafePrimToPrim $ f <$> pcg32f_boundedrand_r p b+  {-# INLINE uniform1B #-}  instance RandomGen FrozenGen where   next s = unsafeDupablePerformIO $ do
src/System/Random/PCG/Single.hs view
@@ -12,7 +12,7 @@ -------------------------------------------------------------------- -- | -- Module     : System.Random.PCG.Single--- Copyright  : Copyright (c) 2014, Christopher Chalmers <c.chalmers@me.com>+-- Copyright  : Copyright (c) 2014-2015, Christopher Chalmers <c.chalmers@me.com> -- License    : BSD3 -- Maintainer : Christopher Chalmers <c.chalmers@me.com> -- Stability  : experimental@@ -47,9 +47,20 @@   , save, restore, seed, initFrozen      -- * Type restricted versions+    -- ** uniform   , uniformW8, uniformW16, uniformW32, uniformW64   , uniformI8, uniformI16, uniformI32, uniformI64   , uniformF, uniformD, uniformBool++    -- ** uniformR+  , uniformRW8, uniformRW16, uniformRW32, uniformRW64+  , uniformRI8, uniformRI16, uniformRI32, uniformRI64+  , uniformRF, uniformRD, uniformRBool++    -- ** uniformB+  , uniformBW8, uniformBW16, uniformBW32, uniformBW64+  , uniformBI8, uniformBI16, uniformBI32, uniformBI64+  , uniformBF, uniformBD, uniformBBool   ) where  import Control.Applicative@@ -178,8 +189,8 @@ foreign import ccall unsafe "pcg_oneseq_64_xsh_rs_32_random_r"   pcg32s_random_r :: Ptr FrozenGen -> IO Word32 --- foreign import ccall unsafe "pcg_oneseq_64_xsh_rs_32_boundedrand_r"---   pcg32s_boundedrand_r :: Ptr FrozenGen -> Word32 -> IO Word32+foreign import ccall unsafe "pcg_oneseq_64_xsh_rs_32_boundedrand_r"+  pcg32s_boundedrand_r :: Ptr FrozenGen -> Word32 -> IO Word32  foreign import ccall unsafe "pcg_oneseq_64_advance_r"   pcg32s_advance_r :: Ptr FrozenGen -> Word64 -> IO ()@@ -196,6 +207,10 @@   uniform2 f (Gen p) = unsafePrimToPrim $     f <$> pcg32s_random_r p <*> pcg32s_random_r p   {-# INLINE uniform2 #-}++  uniform1B f b (Gen p) = unsafePrimToPrim $ f <$> pcg32s_boundedrand_r p b+  {-# INLINE uniform1B #-}+  instance RandomGen FrozenGen where   next s = unsafeDupablePerformIO $ do
src/System/Random/PCG/Unique.hs view
@@ -4,7 +4,7 @@ -------------------------------------------------------------------- -- | -- Module     : System.Random.PCG.Unique--- Copyright  : Copyright (c) 2014, Christopher Chalmers <c.chalmers@me.com>+-- Copyright  : Copyright (c) 2014-2015, Christopher Chalmers <c.chalmers@me.com> -- License    : BSD3 -- Maintainer : Christopher Chalmers <c.chalmers@me.com> -- Stability  : experimental@@ -42,9 +42,20 @@   , advance, retract      -- * Type restricted versions+    -- ** uniform   , uniformW8, uniformW16, uniformW32, uniformW64   , uniformI8, uniformI16, uniformI32, uniformI64   , uniformF, uniformD, uniformBool++    -- ** uniformR+  , uniformRW8, uniformRW16, uniformRW32, uniformRW64+  , uniformRI8, uniformRI16, uniformRI32, uniformRI64+  , uniformRF, uniformRD, uniformRBool++    -- ** uniformB+  , uniformBW8, uniformBW16, uniformBW32, uniformBW64+  , uniformBI8, uniformBI16, uniformBI32, uniformBI64+  , uniformBF, uniformBD, uniformBBool   ) where  import Data.Functor@@ -121,8 +132,8 @@ foreign import ccall unsafe "pcg_unique_64_xsh_rs_32_random_r"   pcg32u_random_r :: Ptr Word64 -> IO Word32 --- foreign import ccall unsafe "pcg_unique_64_xsh_rs_32_boundedrand_r"---   pcg32u_boundedrand_r :: Ptr Word64 -> Word32 -> IO Word32+foreign import ccall unsafe "pcg_unique_64_xsh_rs_32_boundedrand_r"+  pcg32u_boundedrand_r :: Ptr Word64 -> Word32 -> IO Word32  foreign import ccall unsafe "pcg_unique_64_advance_r"   pcg32u_advance_r :: Ptr Word64 -> Word64 -> IO ()@@ -140,3 +151,7 @@     w2 <- pcg32u_random_r p     return $ f w1 w2   {-# INLINE uniform2 #-}++  uniform1B f b (Gen p) = f <$> pcg32u_boundedrand_r p b+  {-# INLINE uniform1B #-}+