Created
November 23, 2016 19:04
-
-
Save chuckwagoncomputing/a2cd35264e629c5a7aa9221c5989726f to your computer and use it in GitHub Desktop.
How much more likely are you to roll 6 dice uniquely than all the same?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
greed = 0 | |
flush = 0 | |
10000000.times do | |
dice = [] | |
6.times do | |
dice.push((1..6).to_a.sample) | |
end | |
if dice.include?(1) and dice.include?(2) and dice.include?(3) and dice.include?(4) and dice.include?(5) and dice.include?(6) | |
greed += 1 | |
elsif dice[0] == dice[1] and dice[1] == dice[2] and dice[2] == dice[3] and dice[3] == dice[4] and dice[4] == dice[5] | |
flush += 1 | |
end | |
end | |
puts "$GREED = #{greed}" | |
puts "Flush = #{flush}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment