Created
November 14, 2010 04:06
-
-
Save m2ym/675897 to your computer and use it in GitHub Desktop.
This file contains 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
import Control.Monad | |
import Control.Applicative | |
import System.Random | |
randomRnIO :: Random a => Int -> (a, a) -> IO [a] | |
randomRnIO n r = sequence $ replicate n (randomRIO r) | |
points :: IO [(Int, Int)] | |
points = liftM2 zip (randomRnIO 10 (0, 100)) (randomRnIO 10 (0, 100)) | |
main = do | |
print =<< points | |
print =<< points -- Different output | |
ps <- points | |
print ps | |
print ps -- Same output |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment