Skip to content

Instantly share code, notes, and snippets.

@flemdizzle
Last active August 20, 2018 20:21
Show Gist options
  • Save flemdizzle/bc0c353ebcdb542b333b1bfed2bd73f7 to your computer and use it in GitHub Desktop.
Save flemdizzle/bc0c353ebcdb542b333b1bfed2bd73f7 to your computer and use it in GitHub Desktop.
CODE GOLF: bubkis frequency calculation in ruby for 10K iterations
p Array.new(10000){Array.new(6){rand(1..6)}}.reject{|r|r.include?(1)||r.include?(5)||r.any?{|d|r.count(d)>2}||r.sort.chunk_while{|p,c|p==c}.count!=4}.size.to_f/10000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment