Skip to content

Instantly share code, notes, and snippets.

@mikecarroll
Last active December 25, 2015 17:59
Show Gist options
  • Save mikecarroll/7016970 to your computer and use it in GitHub Desktop.
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/)!
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}!"
@mikecarroll
Copy link
Author

=> [34, 805, 901, 275, 308, 733, 84, 621, 710, 645, 874, 305, 464, 503, 269, 162, 170, 21, 24, 305, 694, 337, 873, 89, 951, 55, 518, 156, 939, 588, 279, 514, 456, 901, 501, 692, 963, 375, 375, 704, 617]

=> After 41 draws, the winner is: @SkiNatasha!

@mikecarroll
Copy link
Author

=> [8, 129, 126, 777, 459, 496, 873, 85, 422, 423, 73, 351, 714, 359, 289, 253, 876, 776, 110, 517, 737, 180, 553, 251, 21, 610, 113, 863, 978, 895, 379, 101, 358, 480, 693, 186, 771, 426, 776, 457, 729, 126, 445, 199, 587, 377, 155, 440, 110, 771, 741, 528, 276, 561, 194, 52, 792, 268, 923, 460, 442, 271, 999, 551, 108, 378, 486, 877, 520, 390, 596, 478, 788, 965, 77, 132, 290, 393, 15, 270, 917]

=> After 81 draws, the winner is: @_clapaz!

@mikecarroll
Copy link
Author

=> [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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment