Last active
August 29, 2015 14:19
-
-
Save drusepth/35b3b062f0b2ddfd003f to your computer and use it in GitHub Desktop.
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
expected = %w{1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 FizzBuzz}; | |
seed = 0; | |
begin | |
puts "trying seed #{seed}" | |
r = Random.new(seed) | |
throw :nope unless (0..11).to_a.all? {|i| [i+1, "Fizz", "Buzz", "FizzBuzz"][r.rand(4)] == expected[i] } | |
puts "drusepth: Seed #{seed} will do the job just fine" | |
rescue | |
seed += 1 | |
retry | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment