Secret Santa generator
Press Draw to see who gives to whom
Everyone gives a present to exactly one person and receives one from exactly one person, and nobody draws their own name. The draw forms a single chain: Ana gives to Ben, Ben gives to Chiara, and so on until the last person gives back to Ana.
How to draw Secret Santa names
The construction is simple enough to check by eye, and it is worth stating precisely rather than by algorithm name. The list is shuffled into a random order with Fisher–Yates over crypto.getRandomValues, and then each person gives to whoever the shuffle put next to them, with the last person in the ring giving back to the first. Because the ring passes through everybody exactly once, nobody can land on themselves and no two people can land on each other. The result is distributed identically to Sattolo’s algorithm, the textbook method for drawing a random single cycle, and gets there by a different route.
A plain shuffle would not do. Pair people at random with only a no-self-draw check and you can get Ana buying for Ben while Ben buys for Ana, which is valid and ruins the game: each of them knows immediately who has them, and the exchange collapses into a private swap. The chain removes that entirely, because knowing who you give to tells you nothing whatsoever about who gives to you.
The chain does narrow the draw, though, and the numbers are small enough to see. For six people there are 720 possible assignments, of which 265 have nobody drawing themselves. Of those 265, only 120 form a single ring; the rest break into two or more separate loops, such as three people circulating among themselves while the other three do the same. This tool draws uniformly from the 120 and never produces the other 145. That is a deliberate trade. Separate loops are perfectly valid gift exchanges and are arguably better at hiding information, since a group comparing notes can reconstruct part of a ring but learns nothing about a loop they are not in. The ring is preferred here because mutual pairs are the failure people actually complain about, and every two-person loop is a mutual pair.
Two people is the exception, and the guarantee does not hold there. With a list of two the only possible ring is A gives to B and B gives to A, which is a mutual pair by necessity. From three people upward the no-swap property holds without exception. A two-person exchange is not really a Secret Santa; it is just buying each other presents.
Leave the seed box empty. It is offered on every draw on this site because a disputed team selection benefits from being reproducible, and a gift exchange is the one case where that property is a liability: anyone who learns the seed and the list can reproduce the entire draw, including their own giver. If you want a record that the draw was not re-rolled until somebody liked it, keep the copied output rather than the seed.
The limitation nobody can engineer away is that whoever presses the button sees every assignment. Nothing in a browser can hide the result from the person the browser belongs to. Two workable answers: ask somebody outside the exchange to run it and message everyone their own name, or run it yourself and accept that you are the one person playing without the surprise. Pretending otherwise is how a draw quietly turns into an organiser who knew all along.
Exclusions are the other common ask, and the reason they are not here is structural rather than lazy. "Couples must not draw each other" or "not the same person as last year" turns a shuffle into a constrained matching problem, where a badly chosen set of constraints can have no valid solution at all and the algorithm has to detect that rather than loop for ever. Redrawing until an awkward result goes away is the practical substitute, and for one or two constraints in a group of any size it works quickly.
What people use it for
- Drawing an office gift exchange where nobody shares a room
- Replacing the hat when half the group is remote
- Redrawing the whole exchange after somebody pulls out
- Running the draw as a non-participant so no one sees the assignments
- Producing a chain where no two people simply swap
- Sending each person their own line rather than the whole list
Questions
No. The ring passes through every name exactly once, so landing on yourself is structurally impossible rather than something the tool retries until it avoids.
Not with three or more people, because a single ring cannot contain a two-person loop. With exactly two people it is unavoidable, since the only ring is A to B and B to A.
The names are shuffled with Fisher–Yates over crypto.getRandomValues, then each person gives to the next in the shuffled order, and the last gives back to the first.
It produces the same distribution over single cycles by a different route: a full shuffle followed by a ring, rather than Sattolo’s modified swap loop. Any random cyclic permutation is equally likely either way.
Because every two-person loop is a mutual pair, and mutual pairs are the failure people notice. One ring rules them out by construction.
Yes, and deliberately. For six people, 265 assignments have nobody drawing themselves, but only 120 of those form a single ring. The other 145 split into separate loops and never come up here.
Not for the gifts. They are arguably better at hiding information, since people in one loop learn nothing about another. They are excluded because the smallest possible loop is a swap.
No. A seed makes the draw reproducible, so anyone with the seed and the list can work out every assignment including their own. Leave it empty for a gift exchange.
Keep the copied result and the time you drew it, or have a non-participant run it. A seed would prove reproducibility at the cost of the secret.
You cannot, if you run the draw in your own browser. Ask someone not taking part to run it and message everyone privately, or accept that you are the one person without a surprise.
One line per person in a private message. Copying the whole list into a group chat is the single most common way a draw is spoiled.
Not automatically. Exclusions turn the draw into a constrained matching problem, where a bad set of constraints can have no solution at all. Redrawing until the awkward pairing disappears works in practice.
Only by redrawing. The tool has no memory between draws, so it cannot know what happened last year or last week.
Two, though at two it is simply an exchange and both people know everything. Three is the smallest genuine draw; four or more makes it a game.
Redraw the whole thing. Patching one link in the ring leaves the person who was buying for the leaver without a recipient, and the fix usually creates a swap.
Not in the tool. It draws the names and nothing else. Agree a budget separately, before the draw, so nobody is deciding it after they know who they have.
No. The list is shuffled before the ring is formed, so pasting names alphabetically or by desk makes no difference to who gets whom.
Large enough for any office. The work is one shuffle, so hundreds of names draw instantly.
No. It stays in this page and is gone when you close it.
Only if you kept the result. Without a seed the draw is not reproducible, and for this particular tool that is a feature.