Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.