Created
July 18, 2012 09:19
-
-
Save ywjno/3135208 to your computer and use it in GitHub Desktop.
create shuang_se_qiu number
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
#encoding: utf-8 | |
class ShuangSeQiu | |
def initialize | |
@times = ARGV && ARGV[0] ? ARGV[0].to_i : 5 | |
end | |
def create | |
@times.times do |time| | |
reds = [] | |
base_rads = Array.new(36) {|i| i + 1} | |
6.times do |r| | |
length = base_rads.length | |
reds << base_rads.delete_at(Random.rand(0..length - 1)) | |
end | |
puts "red number are #{reds.sort.join(', ')}" | |
puts "blue number is #{Random.rand(1..16)}" | |
puts '='*80 | |
end | |
end | |
end | |
ShuangSeQiu.new.create |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment