[Haskell-cafe] random question
mpm at alumni.caltech.edu
Wed Oct 7 16:59:00 EDT 2009
My thread about randomness got hijacked so I need to restate my remaining
question here. Is it acceptable to write pure routines that use but do not
return generators, and then call several of them from an IO monad with a
generator obtained by several calls to newStdGen?
shuffle :: RandomGen g => g -> [a] -> [a]
shuffle = ...
foo :: [a] -> [a] -> IO ()
foo xs ys = do
g1 <- newStdGen
print $ shuffle g1 xs
g2 <- newStdGen
print $ shuffle g2 ys
Does this kind of thing exhibit good pseudorandomness?
More information about the Haskell-Cafe