HowMuchWorks

Secret Santa Generator

Type everyone's name, add any pairs who should not draw each other (such as couples), set a gift budget and press Draw names. You get a fair random draw and a ready-made line to send to each person. The names and the draw stay in your browser.

How it works

A Secret Santa draw is a permutation with forbidden positions: every person gives exactly one gift and receives exactly one, nobody draws themselves, and excluded pairs never draw each other in either direction.

The generator shuffles the list with a Fisher-Yates shuffle, driven by your browser's cryptographic random number generator, and keeps the first shuffle that breaks no rule. Because each shuffle is equally likely, every valid draw is equally likely too. When exclusions are so tight that 2,000 random shuffles all fail, it switches to a bipartite matching search that always finds a valid draw if one exists, and tells you if none does. That fallback draw follows every rule and is random, but not every valid draw is exactly equally likely; the result says when it was used.

Worked example. Four people in two couples, Ann and Ben, Cal and Dee, with each couple excluded. Each person may only draw someone from the other couple, so Ann and Ben draw Cal and Dee in some order, and Cal and Dee draw Ann and Ben. That gives 2 x 2 = 4 possible draws, for example Ann to Cal, Ben to Dee, Cal to Ben, Dee to Ann. With only three people and one excluded couple there is no valid draw: both partners could only draw the third person.

Without exclusions, the share of shuffles where nobody draws themselves approaches 1/e, about 37% (derangements), so a valid draw is found almost instantly.

Questions

How do I keep couples from drawing each other?

Add each couple on its own line in the exclusions box, separated by a comma, for example "Ann, Ben". The rule works both ways.

Can the organizer take part without seeing their own match?

The organizer sees every pair on screen. To play too, copy the messages without reading them, or ask someone outside the group to run the draw and send them.

Why does it say no valid draw exists?

Some exclusion lists make a draw impossible, for example three people where two are a couple. Remove an exclusion or add another participant.

Is the draw really random?

Yes. Shuffles use your browser's cryptographic random number generator, so every valid assignment is equally likely. With very tight exclusions the tool may fall back to a matching search, which still follows every rule but is not exactly uniform; the result tells you when that happens. Pressing Draw names again gives a fresh draw.

Are the names saved or sent anywhere?

No. The draw runs in your browser; names, exclusions, the budget and the pairs are never uploaded or stored. The site only counts anonymous page views and uses of the tool.