The required structure is a derangement
A valid Secret Santa assignment is a permutation in which no participant receives their own name. Such a permutation is called a derangement. Every person appears once on the giver side and once on the recipient side, while every giver-to-recipient arrow points to a different person. The page repeatedly samples a shuffled recipient order until that no-self condition holds. It assumes the only restriction is “not yourself”; relationships, budgets, and anonymity rules are outside this calculation.
Worked five-person assignment
For Avery, Blake, Casey, Dev, and Emery, one possible result is Avery → Casey, Blake → Emery, Casey → Dev, Dev → Avery, Emery → Blake. The recipient column contains Avery, Blake, Casey, Dev, and Emery exactly once, and no row repeats its left-hand name. Five people need not form two-person pairs: this result includes a three-person cycle Avery → Casey → Dev → Avery. Long cycles are normal in a gift exchange.
How likely is a valid shuffled roster?
There are 5! = 120 possible recipient orders for five names, but only !5 = 44 derangements. A uniformly shuffled order is valid with probability 44/120 = 36.67%, so rejecting self-matches and trying again is expected to finish after roughly 2.73 attempts. Conditioning a uniform shuffle on validity preserves equal likelihood among valid assignments. That is different from repairing a single self-match with an ad hoc swap, which needs care to avoid favouring some mappings.
Verify the result without knowing the random seed
Copy the names on the right of the arrows into a separate column. If sorting that column reproduces the participant roster and no row has the same giver and recipient, the assignment meets this tool's two checks. A duplicate recipient means someone has no giver; checking only that nobody drew themselves would miss that failure. This visible test works after the browser tab has closed.
Constraints can make a simple reroll misleading
Spouses, roommates, managers, last year's matches, or a request not to exchange with a particular person are extra prohibited edges. A no-self generator cannot honestly enforce those rules. Agree on exclusions and use a constraint-aware procedure before producing assignments. Rerunning until a socially pleasing output appears changes what participants were told about the draw and makes the process hard to explain.
Privacy is procedural, not mathematical
The names are processed in the current browser, but a shared screen still reveals every arrow to the organizer and viewers. This page has no private delivery channel, purchase tracking, or lasting record. Do not enter addresses, gift preferences, or other sensitive notes. Before sharing, decide whether the organizer may see the complete mapping and how an absent participant will be handled.
Cycles explain why reciprocal pairs are not required
A derangement can be decomposed into cycles. Avery → Casey, Casey → Dev, and Dev → Avery form a three-cycle; Blake → Emery and Emery → Blake form a two-cycle. Both structures satisfy the no-self condition. A result with only two-cycles may feel familiar, but it is not the only valid exchange and should not be selected after the fact unless reciprocal pairing was part of the announced rule. The page samples valid mappings, not a preferred cycle pattern.
Six participants show the retry rate changing
For six names there are 6! = 720 recipient orders and !6 = 265 derangements, so a random recipient shuffle succeeds with probability 265/720, about 36.81%. The expected number of tries is roughly 1 ÷ 0.3681 = 2.72. The closely related five-person value is not a magic constant; it arises because the fraction of no-self permutations approaches about 1/e as the group grows. MathWorld’s derangement reference gives the inclusion-exclusion formula behind those counts.
Extra exclusions are a matching problem
If Avery cannot give to Blake and Casey cannot give to Dev, the valid arrows are no longer described by a simple derangement count. A reroll-until-it-looks-good routine can be slow, can accidentally omit a constraint, and may expose mappings that should remain secret. Write every forbidden giver-recipient pair first, check that each giver still has a possible recipient, then use an organizer or software that explicitly supports constrained matching. Do not imply this no-self-only page has enforced rules it never receives.
Separate generation from delivery
The result can be mathematically sound and still fail as a secret exchange if it is displayed to the whole group. An organizer who sees all arrows has information that each giver may expect to stay private. Decide whether that is acceptable, how one recipient is informed, and what happens if a participant withdraws. A replacement can break a cycle and require a new disclosed procedure. This browser page neither sends messages nor stores a recovery copy, so copy only the information the organizer is entitled to retain.
Check the roster before revealing any name
Count participants once, then compare the giver column and recipient column against that same spelling list. A blank line, a duplicate surname, or a nickname that names the same person twice changes the matching problem before the shuffle begins. For a five-person exchange, exactly five arrows must be present and every participant must appear once at each end. Correcting a misspelled label after private delivery may require a new assignment, so this small audit belongs before anyone learns a recipient.