random-bytestring-0.1.0: Efficient generation of random bytestrings

Copyright(c) Lars Kuhtz <lakuhtz@gmail.com> 2017
LicenseMIT
Maintainerlakuhtz@gmail.com
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Data.ByteString.Random

Description

  • ------------------------------------------------------------------------- --

Synopsis

Documentation

random Source #

Arguments

:: Natural

Length of the result bytestring in bytes

-> IO ByteString 

Generate a random bytestring of length n. The PRNG is seeded from the system randomness source.

ioProperty $ ((fromIntegral n ===) . B.length) <$> random n
n > 4 ==> ioProperty $ (/=) <$> random n <*> random n

randomGen Source #

Arguments

:: GenIO

A PRNG that is used to generate random bytes.

-> Natural

Length of the result bytestring in bytes

-> IO ByteString 

Generate a random bytestring of length n using the given PRNG.