[Haskell-cafe] Random question

Henning Thielemann lemming at henning-thielemann.de
Wed Sep 24 17:25:49 EDT 2008


On Wed, 24 Sep 2008, Iain Barnett wrote:

> Hi,
>
> I have a function, that produces a random number between two given numbers
>
> rand :: Int -> Int -> IO Int
> rand low high = getStdRandom (randomR (low,high))

If you only need arbitrary numbers, not really random ones, you should 
stay away from IO:
   http://www.haskell.org/haskellwiki/Humor/Erlk%C3%B6nig
   http://www.haskell.org/haskellwiki/Haskell_programming_tips#Separate_IO_and_data_processing


More information about the Haskell-Cafe mailing list