public
anonymous / bestof5.rb
Created

  • Download Gist
bestof5.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12
max = 100
iterations = 10**6
 
total = 0
 
iterations.times {
rolls = []
5.times { rolls.push rand(max) }
total += rolls.max
}
 
puts total.to_f/iterations

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.