Skip to content

Instantly share code, notes, and snippets.

@Nyoho
Created May 1, 2016 04:57
Show Gist options
  • Save Nyoho/9d80fc5fe2370cfb0930e7de8174cc77 to your computer and use it in GitHub Desktop.
Save Nyoho/9d80fc5fe2370cfb0930e7de8174cc77 to your computer and use it in GitHub Desktop.
重複のない整数対の配列を作る
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