Last active
August 20, 2018 20:21
-
-
Save flemdizzle/bc0c353ebcdb542b333b1bfed2bd73f7 to your computer and use it in GitHub Desktop.
CODE GOLF: bubkis frequency calculation in ruby for 10K iterations
This file contains hidden or 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
| 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