If you have a list of items and you want to randomly pair the items in the list together, what kind of algorithm would you use to do that, such that the items can only be matched to one other item.
Take the 2-minute tour
×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.
Randomize the list and then grab pairs of adjacent items. (I'm not sure I understand your last requirement, "the items can only be matched to one other item." If I haven't fully answered your question, please edit the question to expand on that point.) |
|||||||||
|