| First: I had forgotten that what the Random module actually
| gives you is [Integer], not [Int], but the same reasoning
| applies.
What's the range for the Integers? I guess Int is better suited.
| Well, you naturally need functions that convert a list of
| [Integer] to what you need. I'm not at all against such functions,
| and I think they should be included, e.g.
| toDouble :: [Integer] -> [Double]
| toInt :: [Integer] -> [Int]
| etc. So I might write
| let mis = take n (random ss1)
| is = take n (toInt (random ss2))
| ds = take n (toDouble (random ss3))
| in ...
| where ss1, ss2, ss3 are the seeds. You can get them from an initial
| call to randomIO or use some known values if you need to repeat the sequence.
My problem with your solution is that you must supply a seed for every
call (perhaps you don't know how many do you require) and that you may
end up with pseudo-random numbers which are not random at all. Because
you choose the seeds badly. That's why I thread the (current) seed
through all those value generators. Of course, instead of threadening
a seed one could thread an infinite list of Ints.
| I think using monads, and specially a powerful one like IO, everywhere is
| a mistake. I can't see the need for most uses of random numbers.
I agree that the IO monad is not necessary. However, a monad for random
values seems perfectly reasonable.
Ralf