Last active
January 1, 2016 07:49
-
-
Save rubypirate/8113639 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
# this code helps you generate random numbers for euro millions lottery | |
# how to run, ruby euro_millions.rb | |
@numbers = [] | |
@stars_numbers = [] | |
cards_num = 100 | |
cards_num.times.each_with_index do |i| | |
rnum = rand(1..50) | |
stars_number = rand(1..11) | |
if @stars_numbers.count < 2 | |
@stars_numbers << stars_number unless @stars_numbers.include? stars_number | |
end | |
@numbers << rnum unless @numbers.include? rnum | |
if (@numbers.count == 5) | |
p (@numbers << @stars_numbers) | |
@numbers = [] | |
@stars_numbers = [] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment