Guest User

Untitled

a guest
May 22nd, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import System.Random
  2. import Control.Monad
  3.  
  4. total = 100000
  5.  
  6. main = do xs <- replicateM total runTest
  7.           print $ (sum xs) / fromIntegral total
  8.  
  9. runTest = do g0 <- newStdGen
  10.              let list = randomRs (0,1) g0 :: [Int]
  11.              let choices = takeWhile (==0) list
  12.              return $ 100 / fromIntegral (length choices + 1)
Add Comment
Please, Sign In to add comment