Warn about non-uniform distribution with QuickCheck
This commit is contained in:
parent
17879cbecd
commit
1f6ed5711c
@ -80,6 +80,10 @@ drgNewSeed (Seed seed) = initialize seed
|
|||||||
--
|
--
|
||||||
-- It can also be used in other contexts provided the input
|
-- It can also be used in other contexts provided the input
|
||||||
-- has been properly randomly generated.
|
-- has been properly randomly generated.
|
||||||
|
--
|
||||||
|
-- Note that the @Arbitrary@ instance provided by QuickCheck for 'Word64' does
|
||||||
|
-- not have a uniform distribution. It is often better to use instead
|
||||||
|
-- @arbitraryBoundedRandom@.
|
||||||
drgNewTest :: (Word64, Word64, Word64, Word64, Word64) -> ChaChaDRG
|
drgNewTest :: (Word64, Word64, Word64, Word64, Word64) -> ChaChaDRG
|
||||||
drgNewTest = initializeWords
|
drgNewTest = initializeWords
|
||||||
|
|
||||||
|
|||||||
@ -19,7 +19,7 @@ newtype TestDRG = TestDRG (Word64, Word64, Word64, Word64, Word64)
|
|||||||
deriving (Show,Eq)
|
deriving (Show,Eq)
|
||||||
|
|
||||||
instance Arbitrary TestDRG where
|
instance Arbitrary TestDRG where
|
||||||
arbitrary = TestDRG `fmap` arbitrary
|
arbitrary = TestDRG `fmap` arbitrary -- distribution not uniform
|
||||||
|
|
||||||
withTestDRG (TestDRG l) f = fst $ withDRG (drgNewTest l) f
|
withTestDRG (TestDRG l) f = fst $ withDRG (drgNewTest l) f
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user