Last active
January 4, 2016 18:19
-
-
Save cajun-code/8660128 to your computer and use it in GitHub Desktop.
Rand Number Generator
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
#require "random" | |
print "Enter the number of guests:" | |
guests = gets() | |
print "Enter the number of prizes to give away:" | |
prizes = gets() | |
winners = [] | |
prizes.to_i.times do | |
winner = Random.rand guests.to_i | |
while winners.include?(winner) # add if gap in number blocks winner > 29 and winner < 58 | |
winner = Random.rand guests.to_i | |
end | |
puts("The Winner is ##{winner}") | |
10000.times{} | |
winners << winner | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment