import qualified Data.IntMap as I
import Data.List
import System.Random
main = do
rd
<- replicateM
100000 $ rollIkasamaDice
(take 6 $ cycle [1,2]) rd1
<- replicateM
100000 $ rollIkasamaDice
(map sqrt [1..4]) let im
= foldr (I
.update
((Just
$!) . succ)) im0 rd
im0
= I
.fromList
$ zip [1..6] [0,0..]
rollIkasamaDice dist = do
d
<- getStdRandom
(randomR
(0, 1)) :: IO Double
aW1wb3J0IHF1YWxpZmllZCBEYXRhLkludE1hcCBhcyBJCmltcG9ydCBDb250cm9sLk1vbmFkCmltcG9ydCBEYXRhLkxpc3QKaW1wb3J0IERhdGEuTWF5YmUKaW1wb3J0IFN5c3RlbS5SYW5kb20KCm1haW4gOjogSU8gKCkKbWFpbiA9IGRvCiAgcmQgIDwtIHJlcGxpY2F0ZU0gMTAwMDAwICQgcm9sbElrYXNhbWFEaWNlICh0YWtlIDYgJCBjeWNsZSBbMSwyXSkKICByZDEgPC0gcmVwbGljYXRlTSAxMDAwMDAgJCByb2xsSWthc2FtYURpY2UgKG1hcCBzcXJ0IFsxLi40XSkKICBsZXQgaW0gID0gZm9sZHIgKEkudXBkYXRlICgoSnVzdCAkISkgLiBzdWNjKSkgaW0wIHJkCiAgICAgIGltMCA9IEkuZnJvbUxpc3QgJCB6aXAgWzEuLjZdIFswLDAuLl0KICBwcmludCBpbQoKcm9sbElrYXNhbWFEaWNlIDo6IFtEb3VibGVdIC0+IElPIEludApyb2xsSWthc2FtYURpY2UgZGlzdCA9IGRvCiAgZCA8LSBnZXRTdGRSYW5kb20gKHJhbmRvbVIgKDAsIDEpKSA6OiBJTyBEb3VibGUKICBsZXQgdGhyID0gc2NhbmwxICgrKSAkIG1hcCAuIGZsaXAgKC8pID08PCBzdW0gJCBkaXN0CiAgICAgIGEgICA9IHppcCB0aHIgWzEuLl0gOjogWyhEb3VibGUsIEludCldCgogIHJldHVybiAkIHNuZCAkIGZyb21KdXN0ICQgZmluZCAoKGQgPD0pIC4gZnN0KSBhCg==