Last active
December 25, 2015 17:59
-
-
Save mikecarroll/7016970 to your computer and use it in GitHub Desktop.
Win a free ticket to the NYeC Digital Health Conference (http://digitalhealthconference.com/), courtesy of Health Devs (http://www.meetup.com/HealthDevsNYC/)!
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
tickets = {83=>"@_mcarroll_", 9=>"@nygeog", 750=>"@binbrain", 267=>"@sanjivslall", 899=>"@kendeveloper", 99=>"@SkiNatasha", 396=>"@ElFuturero", 600=>"@shahakash", 526=>"@sarahjukes", 512=>"@chasballew", 626=>"@fancyremarker", 4=>"@johnpaulett", 131=>"@shawn_oakley", 19=>"@mackenco", 482=>"@_clapaz"} | |
winner = nil | |
nojoys = [] | |
while winner.nil? do | |
number = rand(1..1000) | |
tickets.include?(number) ? winner = tickets[number] : nojoys << number | |
end | |
p nojoys | |
puts "After #{nojoys.count} draws, the winner is: #{winner}!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
=> [801, 335, 105, 777, 649, 212, 292, 587, 147, 701, 752, 643, 316, 51, 624, 348, 605, 637, 495, 56, 597, 709, 310, 644, 279, 864, 856, 306, 138, 522, 893, 830, 540, 427, 690, 824, 926, 520, 226, 953, 344, 162, 762, 300, 185, 356, 548, 369, 419, 538, 755, 567, 877, 128, 920]
=> After 55 draws, the winner is: @shawn_oakley!