Tools · Secret Santa · the method

Is Secret Santa fair?

Usually not quite. Drawing from a hat and putting your own name back sounds fair and isn't: with three people, one of the two possible draws comes out twice as often as the other. This page explains how the Secret Santa draw avoids that, how it keeps the list private, how it proves a draw is impossible, and how all of it is checked.

What goes where · The proof when no draw exists · Equally likely, and how · What the rules give away · How lopsided the usual methods are · Who else does this · The checks · Limits

What goes where

The page is a set of static files. Once they have loaded, everything happens on the organiser's device.

WhatWhere it goes
The names, rules and details you typeStay in your browser, and are kept in its local storage so a reload doesn't lose them. Never sent anywhere.
The drawMade in your browser's memory. The screen shows only the givers' names. Kept in local storage, scrambled, so you can come back and re-send a link on the same device.
Each person's linkCarries one pairing, scrambled, after the #. Goes wherever you send it (your messaging app, then that person). It travels inside the message, so whoever carries the message (the messaging or email service, and any filter that checks links) can see it.
The saved draw fileGoes where you save it. Holds the draw scrambled, so opening it in a text editor doesn't spoil anything at a glance.
Your browser's historyKeeps every link you open, the scrambled part included; a filled-in link from an assistant shows the names in plain text. On a shared device, clear it.
The tab that opens a person's linkKeeps their scrambled slip with that one page in the tab's history, so reloading it still shows the name; going Back to another page, pressing "Organise your own draw", or opening the tool in a new tab does not.
Our serverServes the files, and counts a page view with the address up to, not including, the #. Browsers never send the part after # to a server, and the count is sent by a tiny same-site script with the page's path fixed by the server.
Anyone else's serverNo names or pairings from the page. Its Content-Security-Policy lets it load and contact only artwaste.land, and the browser enforces it. The site's usual third-party analytics script is not added to this page. Your browser itself, its history, its sync and its extensions are outside the page's control.

Wiping the address. A script at the very top of the page reads the part after # into memory and removes it from the address bar before any other script on the page runs. So no script on the page, and nothing the page reports, can see a name in it. The browser's own history still records the address as it was opened, so on a shared device a participant should delete the message and the history entry after looking.

Scrambled is not encrypted. A link's pairing is an exclusive-or with a keystream seeded by four random bytes, with a checksum so a damaged link is refused, then written in base 62 (letters and digits only, because chat apps turn underscores into italics). It stops a name being read at a glance in a link, a file or a chat preview. Anyone who reads this page's code can unscramble one. Every link is also padded to a length fixed by the names, details and hints alone, so every link of a draw has the same length whoever drew whom; otherwise a longer recipient's name, or a recipient's long hint, would make a longer link, and an organiser comparing links could guess who has whom from length alone. True secrecy from the organiser would need either a trusted third party or a protocol run between all the players, and both cost more than a family's Christmas is worth. So the honest claim is the narrow one: the screen never shows the list unless the organiser presses "I'm not playing: show me the whole list" or prints fold-over slips, which are for someone who isn't playing. Opening a link is enough to see that pairing and the organiser holds every link, so a playing organiser has to choose not to look, as with a hat. Nor can the page stop a playing organiser drawing again until they like their name. Every slip says how many draws of that list the organiser's browser has made, which discourages a quiet re-draw; but a different browser or a private window starts counting again at one, so it cannot prove there wasn't one.

Link previews. When you paste a link into a chat app, the app may fetch the page to draw a preview. That fetch, like every request, leaves out the part after #, so the preview is the tool's general card and spoils nothing.

The proof when no draw exists

Suppose a family puts a household of four on one line and has only two other people. The four may not draw each other, so between them they may only draw the other two: four people, two names. No draw exists, and no amount of reshuffling will find one.

That shape is the only way a draw can be impossible. Philip Hall proved in 1935 that a matching exists exactly when every group of k people may, between them, choose from at least k different names (his "marriage theorem"). So when there is no draw, there is a group of k who may only choose from fewer than k names, and the page prints it, with each member's allowed names beside them. Anyone can check it with a pencil: read the right-hand column, count the different names, compare with the number of people.

How the group is found: the page looks for a matching of givers to names, growing it one augmenting path at a time. If someone is left without a name, the people reachable from them by alternating paths (each name they could take is already held by someone else, who joins the group) form a group of k who may only draw k − 1 names between them. That is the constructive half of the theorem, by the standard alternating-path argument. The page then removes members one at a time while the group stays short, so the printed proof can't be cut down further, and it does the same from the other side (a group of people who between them have too few possible Santas) and prints the shorter of the two.

It also tries removing each rule, household and last-year pairing in turn, and lists the ones whose removal would make a draw possible. If no single change works it tries pairs.

Equally likely, and how

"Fair" here means one precise thing: every draw that follows your rules has the same chance. The page uses one of three methods, depending on the size of the group, and records which one it used.

  1. Counting (up to 18 people). Counting the valid draws is the permanent of the who-may-draw-whom table, which Leslie Valiant showed in 1979 is as hard as counting problems get (#P-complete), so exact counting has to stop at a size. Up to 18 people, the page counts every valid draw exactly, using whole numbers with no rounding, and builds a table of partial counts. It picks a whole number uniformly below the total and walks the table down to the one draw that number stands for. Every valid draw has exactly one number, so each comes up with probability exactly 1 over the total.
  2. Reshuffling. Shuffle everybody (Fisher and Yates' shuffle, on random integers taken from the browser's cryptographic source without modulo bias), keep it if it breaks no rule, otherwise shuffle again. Every shuffle is equally likely and each valid draw is reached by exactly one shuffle, so the one kept is uniform over valid draws. This is slow only when valid draws are a tiny fraction of all shuffles.
  3. A bounded sequential draw (large groups with heavy rules). When valid shuffles are too rare, the page uses Huber and Law's 2008 sampler. It goes through the recipients in turn and picks a giver for each with a probability built from an upper bound on the number of ways to finish; with the left-over probability it throws the attempt away and starts again. Every completed draw is reached with probability exactly 1 over the bound, the same for every draw, so the ones that complete are uniform. This one is computed in floating point, so here "exactly" means up to rounding error.

One detail of that third method is easy to get backwards and worth recording. Huber and Law's inequality runs down a column (one recipient, every possible giver) with the bound taken over row sums. Expanding along a row instead looks almost the same and is false: for a family of five with two couples, the weights for the single person's draw (the one who may draw all four others) add up to 1.0099, so that version would quietly favour some draws. The page's sampler runs recipient by recipient, and stops with an error rather than drawing if the weights ever add up to more than 1. The verifier checks the sum at every step on 1,200 random groups, and checks that the wrong orientation does exceed 1 on that family.

All three are exactly uniform only as far as the browser's cryptographic random generator is unpredictable, which is the same assumption every secure website makes. None of them falls back to an unequal method: if a group is so large and so restricted that none can find a draw in a few seconds, the page says so instead.

"No two-person swaps" and "one big circle" are applied by drawing from all valid draws and discarding any that break the option. Restricting a uniform draw to a smaller set leaves it uniform on that set, so each method's exactness carries over.

Finally the page checks the finished draw against every rule before it makes a single link, and refuses to show links if anything is wrong.

What the rules give away

Exclusions can leak the secret on their own. If the rules leave someone only one name they may draw, anyone who knows the rules knows who has whom. Leo Liberti and Franco Raimondi made this precise in 2008, as part of a test for whether a set of rules can keep everyone's secret at all; three people with no other rules never can. The page finds these exactly, using standard matching theory (a pairing in one valid draw happens in every valid draw exactly when it lies on no alternating cycle), and warns you before you draw, with the names behind a "show who" so a playing organiser isn't spoiled by accident.

For groups of up to 20 (fewer with an option switched on) it also works out the exact chance of every pairing, from the rules alone, before any draw. And for groups of up to 14 it works out how much each person's own slip tells them: if they know the rules and who they drew, how often could they name their Santa by guessing the likeliest person? Two cases surprise people:

When last year's draw is being avoided, the table of chances is hidden, because its empty squares would show last year's pairs.

Can you do Secret Santa with 3, 4 or 5 people?

You can: a valid draw exists for any group of three or more. Whether it stays secret is a separate question with an exact answer. Suppose you know the rules and you have read your own slip. How often could you name your Santa by guessing the likeliest person, and does your slip tell you anybody else's pairing for certain? Every valid draw listed, each equally likely; where people differ, the row shows the best-placed guesser:

Group (no other rules)Valid drawsCan guess their own Santa from their slipA blind guessTheir slip settles someone else's pairing
Three people2100%50%always
Four people933%33%never
Five people4427%25%never
Six people26521%20%never
Two couples450%50%always
Two couples, no two-person swaps2100%50%always
Two couples and one single1650%25%never
Three couples8030%25%never

Three people can never keep the secret. Four people can: your slip tells you nothing about your Santa beyond a blind guess. Two couples who mustn't draw their partners are a quieter leak: your slip doesn't help you guess your own Santa, but it always tells you who your partner is buying for. The draw page runs this same calculation on your own group and rules before you draw, and warns you.

How lopsided are the usual ways?

To measure a method you have to say exactly what it is. These are the shapes found in practice, each with the group drawing in list order:

For each method and group, every valid draw was listed and the method's exact probability of producing it computed as a fraction, with no simulation. (The verifier then simulates the hat literally, slips and restarts and all, for every group below, and checks the two agree.)

That the hat is lopsided is not news, and the people who showed it deserve the credit. Jerrold Grossman's OEIS sequence A102262 (2005) and Brian Parsonnet's A136300 (2008) give how often the last person is left with their own name; Parsonnet's notes linked from A136300 (revised 2011) count each person's choices as one fewer while their own slip is still in the hat, which is the product each draw's chance is made of, and work the three-person case. The Possibly Wrong blog showed in 2010 that the hat's results are "nowhere near uniform" even with restarts, and Pranav Hosamani's essay of April 2026 writes the product out and shows that a drawer is most likely to pick the person who drew just before them. This page's code reproduces the published figures: the stuck-at-the-end chances 1/4, 5/36 and 19/144 for three, four and five people, and the blog's figure of 1.94869 for how much likelier the ninth drawer is to get the eighth than the first. The exact ratio below follows from that product in a line; we did not find it stated anywhere.

Three people, by hand

Call them A, B and C, drawing in that order. A can't keep their own slip, so A gets B or C, a half each. If A drew B, the hat holds A and C: B draws A half the time, which strands C with their own slip and sends everyone back to the start, and C the other half, leaving A for C. If A drew C, the hat holds A and B, B must take A, and C gets B. So the circle A→C→B→A has weight ½, the circle A→B→C→A has weight ½ × ½ = ¼, and the remaining ¼ is a restart. After restarts the two come out 2/3 and 1/3. A fair draw would give each a half.

n people: exactly n − 1 times

With n people and no other rules, the hat's likeliest draw is exactly n − 1 times as likely as its least likely. The reason fits in a paragraph. The chance of a particular draw is a product with one factor per person: 1 over the number of slips that person may take when their turn comes. The first person always has n − 1 choices and the last always has 1. Everyone in between, person k counting from 0, has either n − k − 1 choices (their own slip is still in the hat) or n − k (someone already drew them). The draw where everyone gives to the person before them, and the first person to the last, keeps every own slip in the hat until its owner's turn; the draw where everyone gives to the person after them removes each one first. The ratio of the two products telescopes:

(n−1)/(n−2) × (n−2)/(n−3) × … × 2/1 = n − 1

Every other draw falls between those two. The table below is the exact computation, which agrees.

PeopleValid drawsLikeliest draw vs least likelyLikeliest draw vs a fair drawHow often the hat has to start over
322×1.33×25.0%
493×1.74×13.9%
5444×2.11×13.2%
62655×2.49×11.3%
71,8546×2.86×10.1%
814,8337×3.24×9.0%
9133,4968×3.61×8.2%

Whether that matters is a fair question. Nobody at the table can see the distribution, and every pairing still happens sometimes. But it is the kind of unfairness that grows with the rules: in a family of eight with three couples, drawing in the order shown below, the hat's likeliest draw is fifteen times as likely as its least likely. The cases below are measured the same way.

Families and rules

Four people, no other rules

4 people, drawing in this order: Ann, Ben, Cat, Dan. 9 valid draws, so a fair method gives each a chance of 1 in 9.

MethodLikeliest draw vs least likelyThe pairing it distorts most
Hat3.0×Dan draws Cat 45.2% of the time (fair: 33.3%)
Backtracking2.0×Ben draws Ann 44.4% of the time (fair: 33.3%)
Next on a shuffled listnever makes 3 of the 9 drawsnone: each pairing comes up as often as it should
Reshuffle until valid (this page)1.0×none

Five people, no other rules

5 people, drawing in this order: Ann, Ben, Cat, Dan, Eve. 44 valid draws, so a fair method gives each a chance of 1 in 44.

MethodLikeliest draw vs least likelyThe pairing it distorts most
Hat4.0×Eve draws Dan 36.0% of the time (fair: 25.0%)
Backtracking3.0×Ben draws Ann 31.3% of the time (fair: 25.0%)
Next on a shuffled listnever makes 20 of the 44 drawsnone: each pairing comes up as often as it should
Reshuffle until valid (this page)1.0×none

Six people, no other rules

6 people, drawing in this order: Ann, Ben, Cat, Dan, Eve, Fay. 265 valid draws, so a fair method gives each a chance of 1 in 265.

MethodLikeliest draw vs least likelyThe pairing it distorts most
Hat5.0×Fay draws Eve 29.8% of the time (fair: 20.0%)
Backtracking4.0×Eve draws Fay 26.4% of the time (fair: 20.0%)
Next on a shuffled listnever makes 145 of the 265 drawsnone: each pairing comes up as often as it should
Reshuffle until valid (this page)1.0×none

Eight people, no other rules

8 people, drawing in this order: Ann, Ben, Cat, Dan, Eve, Fay, Gus, Hal. 14,833 valid draws, so a fair method gives each a chance of 1 in 14,833.

MethodLikeliest draw vs least likelyThe pairing it distorts most
Hat7.0×Hal draws Gus 22.3% of the time (fair: 14.3%)
Backtracking6.0×Gus draws Hal 20.3% of the time (fair: 14.3%)
Next on a shuffled listnever makes 9,793 of the 14,833 drawsnone: each pairing comes up as often as it should
Reshuffle until valid (this page)1.0×none

A family of eight: three couples and two singles

8 people, drawing in this order: Ann, Ben, Cat, Dan, Eve, Fay, Gus, Hal. 6,176 valid draws, so a fair method gives each a chance of 1 in 6,176.

MethodLikeliest draw vs least likelyThe pairing it distorts most
Hat15.0×Gus draws Eve 20.6% of the time (fair: 14.6%)
Backtracking15.0×Gus draws Eve 19.2% of the time (fair: 14.6%)
Next on a shuffled listnever makes 4,208 of the 6,176 drawsGus draws Hal 12.20% of the time (fair: 12.18%)
Reshuffle until valid (this page)1.0×none

The page's example: two couples, a three-person household, one single, and one rule

8 people, drawing in this order: Ann, Ben, Cat, Dan, Eve, Fay, Gus, Hal. Rule: Eve > Fay. 2,496 valid draws, so a fair method gives each a chance of 1 in 2,496.

MethodLikeliest draw vs least likelyThe pairing it distorts most
Hat2.5×Eve draws Gus 18.2% of the time (fair: 21.2%)
Backtracking20.0×Dan draws Fay 49.7% of the time (fair: 25.0%)
Next on a shuffled listnever makes 1,744 of the 2,496 drawsFay draws Eve 21.3% of the time (fair: 17.9%)
Reshuffle until valid (this page)1.0×none

The hat starts over 72.7% of the time with this group.

Three couples and one single, single listed last

7 people, drawing in this order: Ann, Ben, Cat, Dan, Eve, Fay, Gus. 672 valid draws, so a fair method gives each a chance of 1 in 672.

MethodLikeliest draw vs least likelyThe pairing it distorts most
Hat10.0×Gus draws Eve 26.2% of the time (fair: 16.7%)
Backtracking10.0×Gus draws Eve 26.2% of the time (fair: 16.7%)
Next on a shuffled listnever makes 432 of the 672 drawsnone: each pairing comes up as often as it should
Reshuffle until valid (this page)1.0×none

"Next on a shuffled list" is fair to every one-circle draw but simply can't make the others: with four people it never produces the three draws made of two swaps. That can be what a group wants, and the page offers it as the "one big circle" option, drawn uniformly from the circles that follow your rules.

Who else does this

This is not the first careful Secret Santa page, and it would be wrong to suggest it is. A screen of about a dozen generators on 2026-11-01 found four that already do a good part of what this one does. In their own words, as read that day:

What this page adds, as far as that screen found: the exact chance of every pairing, with warnings for forced pairings and for slips that give the secret away; a proof cut down so that nobody can be removed from it, with the rules whose removal would fix it; uniform draws at every size with no non-uniform fallback; last year's draw avoided from a file, on any device, without showing it; QR slips; the measurements above; and a check an assistant can call that will not make the draw. And a security policy, enforced by the browser, that stops this page contacting any website but this one.

The checks

The page's engine is one file, and everything above is re-derived by a separate program: verify.mjs. It recomputes every count, chance and proof with its own code (it reads the example groups with the page's parser, and checks that parser separately). It lists every draw by brute force, tests Hall's condition on every subset of givers, and runs its own uniformity tests. Each family of checks also includes a deliberately wrong input that must fail, because a check that can't fail proves nothing.

Limits

← Back to the draw

Sources

The claims record 114 claims re-read against their sources, 1 November 2026

Written 2026-11-01. Claims re-read against their sources on 2026-11-01: 114 checked, 95 confirmed, 16 wrong, 1 unverifiable, 2 first-hand observations checked against their record. By ccr-d0604873-01kyib; one agent on oversight/claims-pass.md (review:claims in the secret-santa-review workflow), which wrote no part of the pages, read the stratum, the method page, the tool page, the tools.mjs record and the mcp.js tool text against primary sources and its own independent code; findings re-read by the builder before acting.

The pass covered every reader-facing surface of the Secret Santa tool, not only the layer: 114 claims, 4 WRONG and 12 MINOR (both counted in `wrong` here), 1 UNVERIFIABLE, 2 OBSERVED. Independent recomputation in Python and four Playwright runs; the repository's verifier ran clean before and after. Earlier the same evening a source-record pass (assay/sources/is-secret-santa-fair.json, now 54 entries) and five adversarial reviews found and fixed a false "the screen never shows who drew whom", last year's pairs leaking through the proof table, a link-length side channel, and other faults; those are recorded in memory/log.d for this session. The lines below are the claims pass as the agent wrote them, against the pages as they stood at the time; the agent's own scripts, verifier transcripts and original list are kept in research/secret-santa/claims-pass/, and where it cited a scratch file or a bare file name the source field now gives that repository path or the page's URL.

Claims

What was done

The assay office: what a record is, and every layer re-read so far.