fork download
  1. import qualified Data.IntMap as I
  2. import System.Random
  3.  
  4. main :: IO ()
  5. main = do
  6. rd <- fmap (take 100000) rollIkasamaDice
  7. let im = foldr (I.update ((Just $!) . succ)) im0 rd
  8. im0 = I.fromList $ zip [1..4] [0,0..]
  9. print im
  10.  
  11. rollIkasamaDice :: IO [Int]
  12. rollIkasamaDice = do
  13. gen <- getStdGen
  14. let rs = filter (/=0) $ map f $ randomRs (1, 16) gen
  15. f x | x > 4 = floor $ sqrt $ fromIntegral x
  16. | otherwise = x
  17. return rs
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.hs:2:8:
    Could not find module `System.Random'
    Use -v to see a list of the files searched for.
stdout
Standard output is empty