Forked from raulsouzalima/raffle_numbers_for_the_mega_sena.rb
Created
December 31, 2009 14:13
-
-
Save caironoleto/266739 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#raffle numbers for the mega sena | |
@nums = [] | |
def avoid_repeating(current) | |
if @nums.include?(current) == true or current == 0 | |
avoid_repeating(rand(61)) | |
else | |
@nums << current | |
end | |
end | |
for i in (0..5) | |
avoid_repeating(rand(61)) | |
end | |
@nums.sort.each_with_index do |num, index| | |
print "#{num}" | |
unless index == 5 | |
print "-" | |
end | |
end | |
puts "\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment