crypto-numbers-0.2.7: Cryptographic numbers: functions and algorithms

LicenseBSD-style
MaintainerVincent Hanquez <vincent@snarc.org>
Stabilityexperimental
PortabilityGood
Safe HaskellNone
LanguageHaskell98

Crypto.Number.Generate

Description

 

Synopsis

Documentation

generateMax :: CPRG g => g -> Integer -> (Integer, g)

generate a positive integer x, s.t. 0 <= x < m

Note that depending on m value, the number distribution generated by this function is not necessarily uniform.

generateBetween :: CPRG g => g -> Integer -> Integer -> (Integer, g)

generate a number between the inclusive bound [low,high].

generateOfSize :: CPRG g => g -> Int -> (Integer, g)

generate a positive integer of a specific size in bits. the number of bits need to be multiple of 8. It will always returns an integer that is close to 2^(1+bits/8) by setting the 2 highest bits to 1.