Random Groups

Secret Santa generator

Press Draw to see who gives to whom

Local · one ring through everyone; no self-draws, no swaps

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

1 Paste everyone taking part, one name per line.
2 Leave the seed box empty. A seed makes the draw reproducible, which is the last thing a secret draw needs.
3 Draw. The list shows each giver and who they buy for.
4 Tell each person their own name privately, or copy the list and paste each line into a separate message.

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.

Sattolo’s algorithm, and why a cycle is not a shuffleMDN, Crypto.getRandomValues()
Was this tool any good?
Internal signal only · I use it to find the tools worth rebuilding