[random] export MonadPseudoRandom

This commit is contained in:
Vincent Hanquez 2015-05-23 11:58:36 +01:00
parent 05e0e1a587
commit ca2ec5a03d
2 changed files with 17 additions and 0 deletions

View File

@ -16,6 +16,7 @@ module Crypto.Random
, DRG(..)
-- * Random abstraction
, MonadRandom(..)
, MonadPseudoRandom(..)
) where
import Crypto.Random.Types

16
tests/Number.hs Normal file
View File

@ -0,0 +1,16 @@
module Number (tests) where
import Imports
import Crypto.Number.Basic
import Data.Bits
tests = testGroup "number"
[ testProperty "num-bits" $ \(Positive i) ->
and [ (numBits (2^i-1) == i)
, (numBits (2^i) == i+1)
, (numBits (2^i + (2^i-1)) == i+1)
]
, testProperty "num-bits2" $ \(Positive i) ->
not (i `testBit` numBits i) && (i `testBit` (numBits i - 1))
]