From: Matthew Moss Date: 2008-06-07T03:00:41+09:00 Subject: Re: Preferable Pairs (#165) Here is some quick code to generate sample preferences. Takes a single optional argument (defaults to 10) which is the number of people to generate. (I've got 34 names in here; if you want to try larger sets, you'll have to add more names.) NAMES = %w(Adam Anna Bob Betty Chuck David Daria Evan Ellen Fred Faye Greg Gail Hank Helen Irene John Janet Laura Matt Maria Nadine Oleg Olivia Peter Pamela Ric k Rosa Steve Susan Theo Tracy Vicki Walter) def sample(n) names = NAMES.sort_by { rand }[0, n].sort names.each do |name| others = names.dup.reject { |other| other == name }.sort_by { rand } puts "#{name}: #{others.join(' ')}" end end sample(Integer(ARGV[0] || 10))