Created
May 1, 2016 04:57
-
-
Save Nyoho/9d80fc5fe2370cfb0930e7de8174cc77 to your computer and use it in GitHub Desktop.
重複のない整数対の配列を作る
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
def nn | |
(rand * 5).to_i + 1 | |
end | |
def random_problem(n) | |
a = [] | |
while a.length < n do | |
a.push [nn,nn] | |
a.uniq! | |
end | |
a.each do |e| | |
puts "$#{e[0]} + #{e[1]} = $ \n\n \\vfill" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment