Created
May 31, 2010 03:16
-
-
Save wlangstroth/419501 to your computer and use it in GitHub Desktop.
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 | |
randPairs :: (RandomGen g, Random a) => (a,a) -> g -> [(a,a)] | |
randPairs range gen = zip as bs | |
where (a,b) = split gen -- create two separate generators | |
as = randomRs range a -- one infinite list of randoms | |
bs = randomRs range b -- another | |
seed = 13561956 :: Int | |
mygen = mkStdGen seed | |
coords :: [(Int,Int)] | |
coords = take 50 $ -- 50 random coordinates derived | |
randPairs (1,100) mygen -- from the random seed above |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment