how to get a random number with Haste

71 Views Asked by At

I write a simple Haskell program using Haste ( https://www.haste-lang.org/ ). I need to get a random number from range 1-100. How can I do this?

1

There are 1 best solutions below

0
chi On

randomRIO (1,100) :: IO Int would generate such a random number.

Note that since this is not a pure value, it can only be used inside the IO monad.

See the System.Random documentation for more information.