-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Efficient generation of random bytestrings
--   
--   Efficient generation of random bytestrings. The implementation
--   populates uninitialized memory with uniformily distributed random 64
--   bit words (and 8 bit words for remaining bytes at the end of the
--   bytestring).
--   
--   Random words are generated using the PRNG from the <a>mwc-random</a>
--   package or the <a>pcg-random</a> package. It is also possible to use a
--   custom PRNG by providing an instance for the <a>RandomWords</a> type
--   class and using the function <a>generate</a> from the module
--   <a>Data.ByteString.Random.Internal</a>.
--   
--   The generated byte strings are suitable for statistical applications.
--   They are <i>not</i> suitable for cryptographic applications.
--   
--   
@package random-bytestring
@version 0.1.3.1


module Data.ByteString.Random.Internal

-- | Generates uniformily distributed random bytestrings of length n using
--   the given PRNG.
generate :: RandomWords g => g -> Natural -> IO ByteString
class RandomWords g
uniformW8 :: RandomWords g => g -> IO Word8
uniformW64 :: RandomWords g => g -> IO Word64


module Data.ByteString.Random.MWC

-- | Generate a random bytestring of length n. The PRNG is seeded from the
--   system randomness source.
--   
--   <pre>
--   ioProperty $ ((fromIntegral n ===) . B.length) &lt;$&gt; random n
--   </pre>
--   
--   <pre>
--   n &gt; 4 ==&gt; ioProperty $ (/=) &lt;$&gt; random n &lt;*&gt; random n
--   </pre>
random :: Natural -> IO ByteString
randomGen :: GenIO -> Natural -> IO ByteString
instance (g ~ System.Random.MWC.GenIO) => Data.ByteString.Random.Internal.RandomWords g


module Data.ByteString.Random


module Data.ByteString.Random.PCG

-- | Generate a random bytestring of length n. The PRNG is seeded from the
--   system randomness source.
--   
--   <pre>
--   ioProperty $ ((fromIntegral n ===) . B.length) &lt;$&gt; random n
--   </pre>
--   
--   <pre>
--   n &gt; 4 ==&gt; ioProperty $ (/=) &lt;$&gt; random n &lt;*&gt; random n
--   </pre>
random :: Natural -> IO ByteString
randomGen :: GenIO -> Natural -> IO ByteString
instance (g ~ System.Random.PCG.GenIO) => Data.ByteString.Random.Internal.RandomWords g
