Hi Lyndon,

Since the example immediately above the exercise used randomRIO, I assumed that randomRIO was to be used as part of the solution to the exercise.

http://en.wikibooks.org/wiki/Haskell/Understanding_monads/State

Also, it was the above mentioned example that introduced me to *liftM2*, about which I posted a question a couple of days ago (subject line: Heavy lift-ing).

The next topic on the wiki page is "Getting Rid of the IO" which seems to be the direction of your post. No doubt I'll have more questions as I plod on.

Thanks for your input,

Michael


--- On Mon, 7/26/10, Lyndon Maydwell <maydwell@gmail.com> wrote:

From: Lyndon Maydwell <maydwell@gmail.com>
Subject: Re: [Haskell-cafe] Random this! ;-)
To: "michael rice" <nowgate@yahoo.com>
Cc: "Max Rabkin" <max.rabkin@gmail.com>, "Ozgur Akgun" <ozgurakgun@gmail.com>, haskell-cafe@haskell.org
Date: Monday, July 26, 2010, 8:29 AM

I find it useful to have a seed argument to nearly all random
functions rather than using ones with an IO signature. This way you
can speed up your program quite a bit and also make testing much
easier. I think that MonadRandom does this automatically too.