Michael Marte wrote:

 | I need to specify an endless stream of independent
 | random number generators.
 | 
 | I wonder whether it is better to use split ... ... or
 | to increment the seed in the recursive call like:
 | [using `next']

I think the Random library needs some serious cleaning up
for the next Haskell release. At the moment, it provides two
primitives:

  next  :: r -> (Int, r)
  split :: r -> (r, r)

Whereas it would be more logical to have two primitives as
follows: *one* way of creating new random seeds (preferably
`split') and *one* way of creating a random value (of some
type) from the seed (such a function could be called `value'
or so).

Then, if a programmer needs `next', it could be implemented
as:

  next r0 = (value r1, r2) where (r1, r2) = split r0

for example. And of course, the Random library should
provide a way (the best way) of generating an infinite list
of random seeds form one random seed.

This could be achieved if StdGen was an instance of
`Random', but somehow this cannot be done (since a StdGen
does not have any bounds).

Regards,
Koen.

--
Koen Claessen         http://www.cs.chalmers.se/~koen     
phone:+46-31-772 5424      e-mail:[EMAIL PROTECTED]
-----------------------------------------------------
Chalmers University of Technology, Gothenburg, Sweden


Reply via email to