Random

Ketil Z. Malde ketil@ii.uib.no
17 Dec 2002 15:20:20 +0100


Mark Carroll <mark@chaos.x-philes.com> writes:

> On 17 Dec 2002, Ketil Z. Malde wrote:
> (snip)
>>         dice :: Integer -> StdGen -> [Integer]
>>         dice n g = take n $ randomRs (1,6) g

> Can we still do this concisely and get the new state of the rng back out
> the other end after the die has been thrown a few times?

Oops; I missed that part!

> Or are things like newStdGen meant to be so cheap that it's fine to
> use lots of different RNGs instead of one that you thread through
> everything?

I've no idea - I've always used StdGen's as if they were going out of
style.  (You can, of course, `split` them and get two for the price of
one)

-kzm
-- 
If I haven't seen further, it is by standing in the footprints of giants