Skip to content

Instantly share code, notes, and snippets.

@raulsouzalima
Created December 31, 2009 05:38
Show Gist options
  • Save raulsouzalima/266627 to your computer and use it in GitHub Desktop.
Save raulsouzalima/266627 to your computer and use it in GitHub Desktop.
#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