Advertisement
Guest User

Untitled

a guest
Feb 7th, 2016
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. counts, n = [], 100000
  2. n.times do
  3. count = 0
  4. 3.times do
  5. count2, toss = 0, 0
  6. while toss != 7
  7. count2 +=1
  8. toss = rand 20
  9. end
  10. count += count2
  11. end
  12. counts += [count]
  13. end
  14. p counts.min, counts.max, counts.inject(:+)/counts.size.to_f
  15.  
  16. your_case = 0
  17. counts.each { |i| if i > 165 then your_case += 1 end }
  18. p your_case/(n/100.0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement