Skip to content

Instantly share code, notes, and snippets.

@drusepth
Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drusepth/35b3b062f0b2ddfd003f to your computer and use it in GitHub Desktop.
Save drusepth/35b3b062f0b2ddfd003f to your computer and use it in GitHub Desktop.
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