Skip to content

Instantly share code, notes, and snippets.

@rubypirate
Last active January 1, 2016 07:49
Show Gist options
  • Save rubypirate/8113639 to your computer and use it in GitHub Desktop.
Save rubypirate/8113639 to your computer and use it in GitHub Desktop.
# 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