Skip to content
SantaSorted

How a Fair Secret Santa Draw Works (and Why Hats Fail)

By SantaSorted Editorial · Updated · 5 min read

At first glance, a Secret Santa draw looks trivial: shuffle the names, give each person one, done. In practice, every group that has pulled names out of a hat has met the same problem: somebody draws their own name. Behind that small annoyance sits a classic piece of mathematics, known as a derangement, and understanding it helps you choose a draw method that is both fair and fast.

What a valid draw looks like

A Secret Santa draw is a one-to-one assignment. Every person gives to exactly one person and receives from exactly one person. Mathematicians call a one-to-one assignment of a set to itself a permutation. For Secret Santa we need an extra rule: no person may be assigned themselves. A permutation in which no element appears in its original position is called a derangement, or in other words a permutation with no fixed points, as Wikipedia’s article on derangements explains.

For four people, A, B, C and D, there are 24 permutations in total. Only 9 of them are derangements. These include the swaps like A gives to B, B gives to A, C gives to D, D gives to C, and the four-person loops like A→B→C→D→A. The other 15 permutations leave at least one person holding their own name.

How many valid draws are there?

The number of derangements of n items is called the subfactorial. Wikipedia lists the first few values: 0 for one person, 1 for two people, 2 for three, 9 for four, 44 for five, 265 for six, 1,854 for seven and 14,833 for eight. By ten people there are already 1,334,961 valid draws. The numbers grow almost as fast as the factorials, which means that for any realistic group there are far more valid draws than anyone could check by hand.

The 36.8 percent rule

If you shuffle a list of names completely at random, what is the chance that nobody ends up with themselves? For eight people, 14,833 of the 40,320 possible shuffles are derangements, a probability of about 36.8 percent. The remarkable fact is that this barely changes as the group gets larger. The chance converges extremely quickly to 1/e, or approximately 0.3679, where e is Euler’s number, the same constant that appears in compound interest and decay. That is true whether you have eight people or eight thousand.

In practical terms, that means a method of “shuffle, check, and shuffle again if someone has themselves” needs about 2.7 attempts on average, whatever the group size. It is a perfectly respectable way to get a uniformly random valid draw, because every derangement is equally likely to survive the check.

Why the hat method fails

When names are drawn from a hat one at a time, each person draws and keeps the slip. The trouble comes near the end. If you are one of the last people to draw, there may be only one slip left in the hat, and it may be your own. Everyone must then start again, or the last two people swap with others, which can produce results that are no longer equally likely. Pulling names from a hat also makes it hard to respect exclusions, such as partners who should not draw each other, without people peeking and redrawing.

The “shuffle and shift” shortcut and its flaw

Another popular method is to shuffle the list of people and then give each person the name next to them, wrapping around at the end. This always produces a valid draw with no one getting themselves, and it is easy to do by hand. Its flaw is that it only creates one large loop: A gives to B, B to C, and so on until the last person gives to A. Of the 14,833 valid draws for eight people, only 5,040 are single loops (that is 7!, the number of ways to order a cycle). Everything else, including every draw in which two people buy for each other, can never occur with this method. The method is still fair in the everyday sense, and some groups prefer it because it avoids swaps. But it is not a uniform pick from all valid draws, and it makes the pattern easy to guess if you know a few matches.

How exclusions change the problem

Real groups usually want extra rules: partners must not draw each other, a manager should not draw a direct report, two siblings should be kept apart. Each exclusion removes some valid draws, and when you add several, you can reach a point where none are left. Imagine four people, A, B, C and D, where A, B and C all have to stay apart from one another, for example three housemates who already exchange gifts. A, B and C could then only give to D, and one person cannot receive three gifts in a one-to-one draw, so no valid draw exists.

A good generator therefore checks exclusions before doing any shuffling, and it searches for an assignment in a way that backs out of dead ends rather than starting from scratch. Our Secret Santa generator assigns the most constrained person first and tries their possible receivers in random order, then moves on, backing up if it gets stuck. If it cannot find a valid draw it reports that your rules are too strict, rather than quietly breaking one.

Avoiding swaps

In a swap, two people end up buying for each other. Some groups like this; others do not, since it removes the surprise. A “no swaps” option rules out all 2-cycles. With three people it forces a single loop. With four people, 6 of the 9 valid draws remain, and larger groups keep the great majority of their valid draws. Our tool offers it as a checkbox.

Keeping the results private

A perfectly fair draw is no use if the organiser reads out the answers. For a draw to be useful, it needs a private reveal. Passing a device and showing each person only their own match works in a room. When people are remote, one common approach is to send each person a link that contains only their own assignment. Be honest about what that means: if the result is simply encoded in the link, anyone with the link can decode it. A more robust method is to have a trusted third party do the draw, or to use a service that stores results on a server and emails them, at the cost of giving that service your names. There is no free lunch: you either trust a person, trust a service, or accept the technical limits of an encoded link.

Fairness checklist

  • Every valid draw should be equally likely, or at least no person should be favoured as a recipient.
  • Nobody can draw themselves.
  • Exclusions are respected and an impossible set of exclusions is reported.
  • Nobody, including the organiser, sees results other than their own, unless the group has agreed otherwise.
  • If someone drops out, you redraw everyone instead of patching, so that the result stays unbiased.

If you would rather skip the maths, the generator does all of the above in your browser in under a second.

Frequently asked questions

What is a derangement?

A permutation in which no item stays in its original place. In a Secret Santa draw, that means nobody is assigned themselves.

What is the chance a random shuffle works?

About 36.8 percent (1/e), regardless of group size for any realistic group. For eight people it is 14,833 of 40,320, or 36.79 percent.

Is a single loop draw unfair?

It is fair in the sense that nobody is favoured, but it only covers a fraction of possible valid draws, and it makes swaps impossible. Some groups like that property.

Sources and further reading