[Haskell] Re: About Random Integer without IO

karczma karczma at info.unicaen.fr
Thu Nov 11 18:10:46 EST 2004

Thomas Davie writes, commenting my statement that one does need any
'stateful' (monadic, etc.) RN generator initializer within the program,
since you can always pass a parameter during its launching. 

> While I agree that it is often useful to start your program with different 
> parameters each time to seed the random number generator, I would argue 
> that this is often inappropriate - supposing we are writing a very simple 
> program to roll a virtual dice.  If the user finds one input that rolls a 
> six, they can then use this repeatedly.  Reading an initialisation file is 
> back to the situation of using IO to generate our seed.

I believe there is no conflict between us, I agree with you. But the
difference betwen us is that I do think rather about serious usages of RN,
not about contrived examples. I think that if somebody faced a purely
functional program to roll a virtual dice, there would be a good deal
of sheer madness involved, either the conceptor/implementor madness, or
the user's, or both. Haskell is not for *that* kind of problems. 

I used Haskell and Clean to do some Monte-Carlo, or to generate sound
using random algorithms (say, Karplus-Strong string initialized by a white
noise). I generated random fractals, etc. It didn't cost me anything to
put different initializations by hand on every run when I wanted to have
different behaviour. But it was MUCH more important to repeat the same
sequence, e.g., after making fast some nice fractal sketch, I relaunched
the program with bigger size/precision, but exploiting the same random
sequence. I repeat, such is my philosophy. Yours is easier, since you are
just discussing, most probably you never used RN for a serious work. If
I am wrong, I apologize. 

Jerzy K. 

More information about the Haskell mailing list