Skip to content

Instantly share code, notes, and snippets.

@tliff
Created May 5, 2014 20:30
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 tliff/6800b8afeb6e8bc38664 to your computer and use it in GitHub Desktop.
Save tliff/6800b8afeb6e8bc38664 to your computer and use it in GitHub Desktop.
success = 0
1000000.times {success += [0,1,2,3,4].zip([0,1,2,3,4].shuffle).select{|a,b| a==b}.size}
puts success.to_f/1000000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment