Skip to content
EN

Published: 2026-06-19

Matching two lists fairly: zip prizes, tasks, and partners at random

You have two lists. People on one side, things on the other: prizes, chores, projects, presentation slots, mentees, conversation partners. You need to connect every name to exactly one thing, and you need it to feel fair — no playing favourites, no obvious pattern, no "wait, why did they get that one again?" Doing it in your head is slow and suspiciously easy to fudge. This is what a two-list matcher is for, and it is a deceptively interesting little problem once you look closely.

The job: a fair bijection, not a coin flip

What you actually want here is a one-to-one assignment — a mapping where every item in list A lands on a distinct item in list B. Mathematicians call that a bijection. The naive instinct is to walk down list A and, for each name, "pick something random" from list B. That goes wrong almost immediately, because random-with-replacement lets the same prize get handed out twice while a different one is never handed out at all. Fair assignment is not about each individual pick being random; it is about the whole arrangement being one of the equally-likely orderings.

The clean way to get there is to leave list A in place and shuffle list B, then line them up side by side. Position one of A meets position one of the shuffled B, position two meets position two, and so on. Because the shuffle is unbiased, every possible pairing of the whole set is equally likely, and you get the one-to-one property for free — no item of B can appear twice, because shuffling just rearranges; it never duplicates. That is exactly how the Two-List Random Matcher works: paste names into list A, paste the things into list B, click Match, and it zips A to a freshly shuffled B.

Why "shuffle then zip" beats "pick one at a time"

It is worth being concrete about why the lazy version is wrong, because it is the version most people reach for. Say you have four people and four prizes. If you let each person grab a random prize independently, there is a real chance two of them grab the same prize and one prize goes home with nobody. To patch that you would have to detect collisions and re-draw, and re-drawing introduces its own subtle bias toward certain arrangements. Shuffling sidesteps the whole mess: a single unbiased shuffle of list B is already a uniformly random permutation, so the matching is uniformly random too, with no retries and no skew.

The shuffle itself matters. A proper Fisher–Yates shuffle — the kind that walks the list once and swaps each element with a randomly chosen earlier-or-equal position — gives every ordering an exactly equal chance. The popular shortcut of sorting by a random key looks fine and is quietly lopsided; we wrote a whole post about that in shuffling a list without bias . The matcher uses the unbiased version, so you do not have to think about it.

When the lists are not the same length

Here is the part that trips people up, and it is worth knowing exactly what the tool does rather than guessing. The matcher walks down list A and assigns each entry the next item from the shuffled B, wrapping around to the start of B when it runs out. That single rule produces two different behaviours depending on which list is longer.

If B is longer than A — more prizes than people — the extra B items simply go unused. Four people, six prizes: four get assigned, two prizes sit on the shelf. That is usually what you want; you are matching everyone in A and the surplus is just surplus.

If A is longer than B — more people than prizes — the matcher wraps around and reuses items from B. Six people, four prizes: the fifth and sixth person get paired with the first and second items of the shuffled B again. The assignment is no longer one-to-one, by necessity, because you cannot give six distinct things to six people when only four things exist. If that reuse is not acceptable for your situation — you genuinely have four prizes and four winners, full stop — make the lists the same length first, or accept that some people will share. Knowing the wrap rule up front saves you from staring at a duplicate and wondering whether the tool is broken. It is not; it is doing the only sensible thing with lopsided lists.

Reproducible draws with a seed

Random is great until somebody asks you to prove you did not rig it. The matcher has an optional seed field for exactly that. Type any word or phrase into it, and the shuffle becomes deterministic: the same seed with the same two lists produces the same pairing every single time. Leave it blank and you get a fresh, genuinely unpredictable draw on every click.

The seed is the honest way to run a public draw. Announce the seed in advance — the date, a phrase everyone agreed on, a number read off a livestream — then anyone can paste the same two lists and the same seed and confirm the result for themselves. It turns "trust me, it was random" into "here is how to reproduce it." For prize draws, chore assignments people grumble about, or anything where a loser might cry foul, that reproducibility is worth more than the randomness itself.

Real uses that are just two lists in disguise

Once you start looking, a surprising number of everyday assignment problems are two-list matches. Assigning raffle prizes to winners. Handing out chores to housemates for the week. Pairing students with discussion topics, or mentees with mentors. Allocating presentation slots to teams. Giving each tester a different build to check. Drawing names for a gift exchange where the gifts are predetermined. In each case you have a list of recipients and a list of things, and you want a clean, fair, repeatable pairing between them.

The matcher keeps a short history in your browser — stored on your device, nowhere else — so you can glance back at the last few draws, and it can copy the result out as plain text so the pairings land straight into a spreadsheet, a group chat, or an email to whoever needs the official record.

When a different tool fits better

Two-list matching is the right shape only when both sides are fixed lists and you want a straight pairing between them. A few neighbours solve adjacent problems:

If you are pairing people with each other rather than with a second list — partners, buddies, one-on-one rounds — you want the Random Pair Generator , which splits a single list into twos. If you are distributing a pile of items as evenly as possible across people — three people, ten tasks, keep the counts balanced — that is the job of the Fair Division Tool , not a one-to-one zip. And if every person should simply be handed exactly one prize from a pool, the Prize Assigner is the more direct fit.

The short version

Put your people in one box and your things in the other. Add a seed if you want to be able to prove the draw later, or leave it blank for a one-off. Click Match, and the tool shuffles list B with an unbiased shuffle and zips it to list A — one item each, wrapping only if you forced it to by giving it more names than things. It is a small tool for a small job, but it is the kind of small job that, done by hand, somehow always ends in an argument. Hand it to the Two-List Random Matcher instead and go spend your time on something that actually needs a human.

← Back to all posts

Send feedback

Found a bug, want a feature, or just say hi? Send it our way.