Dave Tapley wrote:
> This code show a trivial case where randomness (and hence the IO
> monad) is not used and the first 10 elements of the produced list
> are printed:
You don't need the IO monad to achieve pseudy-randomness. Why not use
'randoms' from System.Random (or 'randomRs' for a range).
take 10 $ (randomRs (1,6) (mkStdGen 1)) :: [Int]
You can use the IO monad to get a randomly seeded generator from the
outside, but once seeded, just use the list.
gen <- newStdGen
take 10 $ (randomRs (1,6) gen) :: [Int]
Dave