packages feed

tf-random 0.1 → 0.2

raw patch · 3 files changed

+19/−5 lines, 3 filesdep ~base

Dependency ranges changed: base

Files

src/System/Random/TF/Gen.hs view
@@ -1,4 +1,4 @@-{-# Language BangPatterns, MagicHash, ForeignFunctionInterface, UnliftedFFITypes #-}+{-# Language CPP, BangPatterns, MagicHash, ForeignFunctionInterface, UnliftedFFITypes #-} -- | -- Module    : System.Random.TF.Gen -- Copyright : (c) 2012-2013 Michał Pałka@@ -17,7 +17,7 @@  import qualified System.Random as R -import System.IO.Unsafe ( unsafeDupablePerformIO )+import System.IO.Unsafe  import Data.Bits import Data.Char (toUpper, isSpace)@@ -27,6 +27,11 @@ import Data.Primitive.ByteArray  import Numeric++#if !MIN_VERSION_base(4,4,0)+unsafeDupablePerformIO :: IO a -> a+unsafeDupablePerformIO = unsafePerformIO+#endif  foreign import ccall unsafe "skein.h Threefish_256_Process_Block"   threefish256EncryptBlock ::
src/System/Random/TF/Instances.hs view
@@ -1,4 +1,4 @@-{-# Language BangPatterns, ScopedTypeVariables #-}+{-# Language CPP, BangPatterns, ScopedTypeVariables #-} -- | -- Module    : System.Random.TF.Instances -- Copyright : (c) 2012-2013 Michał Pałka@@ -21,6 +21,14 @@  import System.Random.TF.Gen +#if !MIN_VERSION_base(4,5,0)+unsafeShiftR :: Bits a => a -> Int -> a+unsafeShiftR = shiftR++unsafeShiftL :: Bits a => a -> Int -> a+unsafeShiftL = shiftL+#endif+ myUnfoldr :: (t -> (a, t)) -> t -> [a] myUnfoldr f g = x' : myUnfoldr f g'   where@@ -66,6 +74,7 @@  -- Inspired by Java's java.util.Random. -- This version avoids division modulo.+-- Returns a random number from range [0..k-1], or from the full range if k = 0. {-# INLINE randomWord32' #-} randomWord32' :: RandomGen g => Word32 -> g -> (Word32, g) randomWord32' k
tf-random.cabal view
@@ -10,7 +10,7 @@ -- PVP summary:      +-+------- breaking API changes --                   | | +----- non-breaking API additions --                   | | | +--- code changes with no API change-version:             0.1+version:             0.2  -- A short (one-line) description of the package. synopsis:            High-quality splittable pseudorandom number generator@@ -86,7 +86,7 @@    -- Other library packages from which modules are imported.   build-depends:-    base >= 4.5 && < 5,+    base >= 4.2 && < 5,     primitive >= 0.3,     random >= 1.0.1.1,     time