Back to Blog

A random draw should happen once

How Deranged Draw keeps no-self assignments stable across private links, reloads, and a new participant-submission flow.

Deranged DrawPostgreSQLProduct Engineering

In Deranged Draw, everyone puts in a slip and gets someone else's. It can be a writing prompt, a game idea, a challenge, or whatever the group agrees to exchange.

Then people open their links at different times. That has to leave the draw alone.

Fix the result before anyone opens it

The server shuffles the participants with Fisher-Yates and a cryptographic random source. It rejects permutations that assign anyone their own slip. Once there's a valid result, one database transaction writes the draw with its participants and all of their assignments.

Every reveal page reads the stored assignment, so whether someone reloads immediately or comes back later, there's no second draw and being the first person to open a link doesn't affect who gets the remaining slips.

Opening a result is a read.

Randomness happens during creation, when the server can validate the whole result and commit it together. For two people, the only valid outcome is an exchange. Larger groups have more valid permutations, but each participant still gets one fixed result and never their own submission.

Let people submit their own slips

The initial flow had the organizer enter every submission. In the newer open-draw flow, each person follows a shared link to choose their name and write a slip.

The organizer gets a roster showing who's in and who's missing.

They can't read the submissions. The management page keeps those two kinds of information separate.

Once at least two people have joined, the organizer can draw over those participants, storing every assignment together and closing the draw. People who didn't submit are left out, even if their names were on the invitation roster, so the management page needs to make that difference clear.

Management, join, and reveal links grant different actions: a reveal page shows the assigned slip without identifying its author, while the management page distributes links without listing everybody's results.

A chat client may request a preview before the recipient opens a link. That preview contains the draw title and recipient information. The assigned text stays out of it.

Invalid or tampered links get a generic not-found response. Joining doesn't require an account; access comes from the appropriate link.

Keep the promise small

There are no rerolls or edits after drawing. Adding them would require rules for replacing assignments after other participants have already seen their results, and for keeping the exchange fair.

The current flow stops at the fixed draw. Each person's private link keeps showing that result.

Try Deranged Draw or read the project details.