- on lion (and snow leopard i suppose), make sure you are using a 64 bit install of ghc. Also, unless you are suggesting an edit to these directions, please go ask people on the relevant mailing list or wiki for help :)
- Tested on Mac OS X 10.7.4, GHC 7.4.1, 64bit Haskell Platform 2012.2.0.0 (installer package) with Command Line Tools for XCode (June 2012).
- These notes were originally brought to you by Carter Schonwald; the “I” probably refers to him. Eric Kow will refer to himself in the third person).
- Forked from kowey (Eric Kow): https://gist.github.com/2420144
This file contains hidden or 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) |
NewerOlder