Hi,

you need to reallise that Haskell is a pure language. That means a function has 
the same result if you call it with the same arguments (deterministic). A 
function that produces random numbers are not of such kind in the first place.
However, what you need to do is to pass the random number generator though the 
function:
See e.g. System.Random.random [1] which takes the generator and gives you a 
random value and the new generator back.

 Georg

[1] 
http://www.haskell.org/ghc/docs/latest/html/libraries/base/System.Random.html

PS: this question is more appropriate for haskell-cafe.

On Thu, 11 Nov 2004 14:40:35 +0000, Jose manuel Hernando CobeÃa <[EMAIL 
PROTECTED]> wrote:

I need generate random numbers by create polygons with "wxHaskell",
I am searching in the web, but all I only find IO functions like
test :: Integer -> IO Integer
test n = do x <- randomRIO (1, n)
return x
I need this but with types :: Integer -> Integer

Thanks

Escapadas, fines de semana, vacaciones, reservas. Organiza y contrata tus viajes
aquÃ.

_______________________________________________

Haskell  mailing  list

[EMAIL PROTECTED]

http://www.haskell.org/mailman/listinfo/haskell



--

---- Georg Martius,  Tel: (+49 34297) 89434 ----
------- http://www.flexman.homeip.net ---------
_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to