Created
March 6, 2012 19:11
-
-
Save jonathanjouty/1988336 to your computer and use it in GitHub Desktop.
Shouldn't this be what you need?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import System.Random | |
-- Test validity of function on a given number of random tests. | |
testRandom :: Random a => StdGen -> Int -> (a -> Bool) -> Bool | |
testRandom gen n f = all f generated | |
where generated = take n $ randoms gen | |
-- Examples of use in GHCi: | |
-- r <- getStdGen | |
-- testRandom r 100 ((\a -> a==a) :: Int -> Bool) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment