random numbers

Bernard James POPE bjpop at cs.mu.OZ.AU
Fri Oct 24 17:08:03 EDT 2003

Jacinta wrote:
> Firstly, I am trying to generate random numbers in Haskell, but although I
> have found a 'random' library on www.zvon.org, I don't really know how to
> include library functions, and the documentation given doesn't really tell
> me the effective difference between all the functions provided in the
> library. In another interesting development, I couldn't find any mention
> of this library in haskell.org's list of libraries.


to include the library you'll need:

import Random

at the top of your module.

Using the routines is a bit fiddly, so you might need to experiment for a while. 

Here's a start:

  dice = do { x <- getStdRandom (randomR (1::Int,6)) ; print x}

> Secondly, but perhaps more importantly, is there a more 'beginnerish' list
> that I should be addressing this to? I've been following discussions on
> this one and they don't seem to be at quite this level.

I think the Haskell cafe is a fair place for such questions. I think you are from
Melbourne Uni, if so we have a local newsgroup called cs.programming that you
can also try. Some local Haskell people (like me) read it all the time. 


More information about the Haskell-Cafe mailing list