In a Secret Santa, everybody draws a name from a hat, and nobody wants to draw their own. How likely is it that the draw works the first time? The answer is a classic of combinatorics: counting derangements, arrangements in which nothing stays in its place. This calculator gives the number of valid draws, the chance that nobody draws their own name, the chance that exactly k people do, and the average number of redraws needed.
How the calculation works
- Total arrangements = n!
- Derangements !n = the whole number nearest to n! ÷ e, or n! × (1 − 1/1! + 1/2! − … ± 1/n!)
- Chance nobody draws their own name = !n ÷ n!
- Exactly k fixed names = C(n, k) × !(n − k) ÷ n!
- Average number of draws = n! ÷ !n
Example
For 10 people, there are 3,628,800 ways to hand out the names, and 1,334,961 of them are derangements. The chance that nobody draws their own name is 36.79 %, so at least one person draws their own name 63.21 % of the time. The chance of exactly one person drawing their own name is also 36.79 %. On average you need 2.72 draws before the result is valid.
Why it matters
The result is surprising: the chance does not shrink as the group grows. With 5 people it is 36.67 %, with 10 it is 36.79 % and with 15 it is 36.79 % again. This means you never need a clever algorithm for a gift exchange: draw, check, and redraw if someone has their own name. The same maths answers the classic problem of the hat-check girl who returns hats at random, and the number of matching letters when n letters go into n envelopes by chance.
Good to know
The calculation treats every arrangement as equally likely and ignores rules such as “couples cannot draw each other”, which reduce the number of valid draws and raise the number of redraws. For groups larger than 15 the counts grow beyond the precision of a calculator, but the probability stays at 1/e. This tool is for education and party planning.
In practice
For a fair, hassle-free exchange, have each person draw in private, ask anyone with their own name to say so quietly and redraw only those names, or use an app that excludes couples. Keep the list of exclusions short so a valid arrangement still exists.
Related tools
The permutations calculator counts ordered arrangements, the birthday paradox calculator covers another surprising probability and the expected value calculator averages outcomes.