State Transformer

Ketil Z Malde
08 Jan 2002 08:42:27 +0100

Jorge Adriano <> writes:

> Anyway, I was coding some simple GA, and as you probably know I need to use 
> random values. The most elegant way I could think of was to generate some 


> Monads! (right?)

Well, I suppose so.  Generally speaking.

But, you might want to consider using the standard random generation
routines from the (IO) top level of your program, and just split the
random generator for each function that uses it.  IOW, passing each
function its own random generator, instead of worrying about returning
the "rest" of a global random sequence.

(I don't have any good example code, I'm afraid, but at leat have a
look at the chapter on Random in the library report on

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