Created
June 1, 2012 13:28
-
-
Save emctoo/2852151 to your computer and use it in GitHub Desktop.
generate random int
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
import qualified Random | |
main :: IO () | |
main = do | |
a <- randInt 0 100 | |
putStrLn $ show a | |
-- generate random number between [lo, hi] | |
randInt :: Int -> Int -> IO Int | |
randInt x y = Random.getStdRandom (Random.randomR (x, y)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment