Skip to content

Instantly share code, notes, and snippets.

@emctoo
Created June 1, 2012 13:28
Show Gist options
  • Save emctoo/2852151 to your computer and use it in GitHub Desktop.
Save emctoo/2852151 to your computer and use it in GitHub Desktop.
generate random int
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