[Haskell] Re: About Random Integer without IO
karczma
karczma at info.unicaen.fr
Thu Nov 11 17:02:29 EST 2004
Thomas Davie writes:
> This method unfortunately depends on having a seed first though.
Which "this method"? Please, quote the text you are referring to *before*
your answer.
> One must
> use a different value every time the program is started, commonly time or
> the first few bytes from /dev/random. Any one of these is going to
> require a monadic function to generate (i.e. it must come from the
> environment in some way - it must change every time you run the program)
>
> So while this eliminates the IO monad from most of the program, it must
> still be initiated using it.
I understand that you mean the seed-propagation method.
You are *partly* right, that the same program executed several times will
generate the same sequence, if initialized identically. But there is no
need for monads, it suffices to pass a parameter, or to read a different
initialization file each time.
Of course, anybody, especially somebody contributing to this list has
the right to be a nit-picker. But, if one is a *practical* user of
random stuff, then he/she usually knows such details. Moreover, it is
sometimes very useful to control absolutely the initialization, to be
able to repeat the experiment, so, professionals in Monte Carlo, etc.
rarely if ever, use time, or system-dependent (and hidden) random values.
For me the initialization is a *context* problem, which I separate from
the properties of the random generator. It is its quality, lack of
correlations, etc. which is important. Do you know of many problems
requiring an automated, truly random initialization? In this case one
may well delegate this issue to the *launching* of the functional program,
instead of struggling with it from within.
This is my personal philosophy, everybody is entitled to his/hers.
Jerzy Karczmarczuk
More information about the Haskell
mailing list