Skip to content

Instantly share code, notes, and snippets.

@eiel
Forked from Nyoho/random_problem.rb
Last active May 3, 2016 01:57
Show Gist options
  • Save eiel/a9a365e65ce834cc27a92ec9443c3af7 to your computer and use it in GitHub Desktop.
Save eiel/a9a365e65ce834cc27a92ec9443c3af7 to your computer and use it in GitHub Desktop.
重複のない整数対の配列を作る
def random_problem(n)
a = [*1..5]
a.product(a)
.shuffle[0..n]
.each do |e0, e1|
puts "$#{e0} + #{e1} = $ \n\n \\vfill"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment