Talk:Haskell/Libraries/Random

I understand that random numbers are a slightly more advanced topic in Haskell. However, I think most people who have programmed before and who are interested in trying Haskell will want/need random numbers. The information in this page is fine, but I thought it was a bit too technical for somebody who just wanted to get random numbers working. He/she may decide to read the theory later.

I suggest having an introductory section which is just copy & paste (like the rest of the wikibook). I had to google around for a while until I could finally be able to read the page.

A few examples with rolling a die or tossing a coin should suffice.


 * That sounds good. How about giving it a shot?  It's ok, nay, better if you don't feel yourself to be completely at ease yet, because you know what interests new Haskellers most.  Somebody can always come in to clean up.  -- Kowey 08:26, 18 March 2007 (UTC)

Examples don't work.
Hi, i'm pretty new to haskell, but i understood the text, and i copied the exact examples in a file to test them. They don't work. I can't get a working RNG, no matter what i do. The examples always give type errors.

Simply try to put the stuff in a .hs-file yourself, and run/open it with hugs. Then - if you get this far - try using them together to simply recreate a normal generation and outputting (putStr (show r)) of one random number ... No RNG for me. :((

If yu can, try to change the page in a way that lets others quickly try the examples. :)


 * Thanks for that. If you're on IRC, could you maybe paste what you had on http://hpaste.org and see if the #haskell'ers can help?  I'm too busy to work on this, sadly -- Kowey 06:55, 16 April 2007 (UTC)

All I want is a simple example
Hi, I'm new as well, and I just don't understand what's currently here. I just want to get something that I can type into the hugs interpreter and see random numbers (of any range) come out. I'm not interested in function definitions, I just need a working example. When I finally get one, maybe I'll update this page, but I don't have the knowledge to do so right now. Any guru's out there who could supply one?


 * Hey there. I copied this from the Haskell cookbook:

main = do  gen <- getStdGen ns <- randoms gen print $ take 10 ns
 * If you have a moment, maybe you could work it into the text? -- Kowey 05:46, 25 April 2007 (UTC)

Redundant with State monad chapter
We really should gut this so it doesn't try to teach the same lessons as the State monad chapter. Instead, this should emphasize the precise functions from the libraries with examples and advice about their use. Backfromquadrangle (discuss • contribs) 21:12, 16 May 2014 (UTC)