[Haskell-cafe] Random this! ;-)

michael rice nowgate at yahoo.com
Sun Jul 25 11:51:58 EDT 2010


Hi Max,

Wow!

I tried both *sequence* and *replicate* but guess I didn't put them together properly. I didn't even know there was a *replicateM*.

Much cleaner.

Thanks

Michael

--- On Sun, 7/25/10, Max Rabkin <max.rabkin at gmail.com> wrote:

From: Max Rabkin <max.rabkin at gmail.com>
Subject: Re: [Haskell-cafe] Random this! ;-)
To: "michael rice" <nowgate at yahoo.com>
Cc: haskell-cafe at haskell.org
Date: Sunday, July 25, 2010, 11:44 AM

On Sun, Jul 25, 2010 at 5:39 PM, michael rice <nowgate at yahoo.com> wrote:
>
> I know, ugly, but at least I got it to work. What's a better way to generate this list?

rollNDiceIO n
   = sequence . replicate n $ randomRIO (1,6)
{{ sequence . replicate n = replicateM n }}
   = replicateM n $ randomRIO (1, 6)

--Max



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100725/854d804d/attachment.html


More information about the Haskell-Cafe mailing list