| Could somebody - perhaps outside this list - provide a serious
| example showing the *necessity* for RandomIO() - the Monadic, 
| "side-effect" version? In a pure functional language?

Well, I'm not outside this list ;-). Honestly, there is no necessity
for using the IO monad, it is just a matter of convenience, see below.

| I use random numbers from time to time.
| I have always used sequences, lazily generated. No problem
| with the seed injection/restoring, and - what is *much* more 
| important:
| 
| No problem with having *several* generators within the program.

The stream-based approach has its problems if one requires random
values of different types. If this is vital one automatically starts to
use functions of type Seed -> (value, Seed). Sooner or later you
recognize that you are programming in a state monad. Now, one could
define a specialized monad or misuse (if you like) IO.

| In a serious application this is useful for generating random
| vectors, or for using one generator to decorrelate another.
| I agree with the comments of David Tweed. Please give the
| People the Power to plug-in several generators, instead of
| eine Sprache, eine Kirche, ein ZufallsZahlGeneratorIO()...

I don't see why this should be a problem. The dilegent user is always
free to plug in new generators, simply by supplying modules which have
the same signature as `Random'.

| You might answer that a primitive is more efficient. But in
| typical simulations or other applications which use random
| numbers (Monte-Carlo, etc.) this is usually not as important.

It's probably both more efficient and more convenient ;-).

Cheers, Ralf


Reply via email to