Skip to content

Instantly share code, notes, and snippets.

@flemdizzle
Last active August 20, 2018 20:12
Show Gist options
  • Save flemdizzle/e8c3d81ff7fcdd3d7eb9806a2b675975 to your computer and use it in GitHub Desktop.
Save flemdizzle/e8c3d81ff7fcdd3d7eb9806a2b675975 to your computer and use it in GitHub Desktop.
Readable
p Array
.new(10000){Array.new(6){rand(1..6)}}
.reject do |roll|
roll.include?(1) ||
roll.include?(5) ||
roll.select{ |die| roll.count(die) > 2 }.any? ||
roll.sort.chunk_while{ |previous_die, current_die| previous_die == current_die }.count != 4 }
end
.count.to_f/10000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment