[prev in list] [next in list] [prev in thread] [next in thread]
List: haskell-cafe
Subject: Re: random numbers
From: Derek Elkins <ddarius () hotpop ! com>
Date: 2003-10-24 7:41:39
Message-ID: 20031024034139.0000539e.ddarius () hotpop ! com
[Download RAW message or body]
On Thu, 23 Oct 2003 23:01:30 -0700 (PDT)
Hal Daume III <hdaume@ISI.EDU> wrote:
> Hi!
>
> > I'm very much a beginning programmer, studying Haskell. I have two
> > questions -
>
> Great! Beginners are very welcome!
>
> > 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.
The standard libraries are described in the Haskell Report.
www.haskell.org/libraries are -other- libraries written for/using
Haskell. I imagine most tutorials give at least a quick introduction to
the more useful libraries. ZVON.org is meant as a reference. You can
find a lists of tutorials and other learning material at
www.haskell.org/learning . The Report is also fairly readable including
the Random library documentation and an online version can be found at
www.haskell.org/onlinereport .
> You want to put 'import Random' at the top of your program. A bit of
> a warning, though: using random numbers isn't entirely straightforward
> in Haskell, due to the fact that it is a pure language (which means
> that you cannot have a function like 'randomInt :: () -> Int' which
> will return a random integer
<unhelpful poor humor: ignore this>
Sherr it can return a random integer, it just has to always be the same
random integer.
</unhelpful poor humor>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic