Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import System.Random
- import Control.Monad
- total = 100000
- main = do xs <- replicateM total runTest
- print $ (sum xs) / fromIntegral total
- runTest = do g0 <- newStdGen
- let list = randomRs (0,1) g0 :: [Int]
- let choices = takeWhile (==0) list
- return $ 100 / fromIntegral (length choices + 1)
Add Comment
Please, Sign In to add comment