HakoTools

Ghost Leg Generator (Amidakuji)

A ghost leg, or amidakuji, pairs everyone with an outcome by following a tangle of lines. Enter the names and the outcomes and the rungs are placed at random, so nobody running it can steer the result.

Published: / Published by the HakoTools team

How it works

What is a ghost leg?

A ghost leg, known in Japan as amidakuji, assigns each person an outcome by having them follow a line through a ladder of random rungs. Everyone gets a different outcome, and until you trace a line nobody can tell which. It is the standard way of handing out chores, deciding an order or running a gift exchange in Japan, and it works for any situation where a list of people needs pairing with a list of things.

This version draws the ladder for you and animates the path. Names and outcomes stay in your browser and are never sent anywhere.

How to use it

  1. Enter the names, one per line, between 2 and 12 of them
  2. Enter the same number of outcomes, one per line
  3. Press Draw the ladder. The rungs are placed randomly at that moment
  4. Tap a name to follow that line down, or reveal everyone at once
  5. Press draw again for a completely new ladder

Why can two people never get the same outcome?

Because every rung is a swap. A rung joins two neighbouring lines and exchanges whatever is travelling down them. Start with each person on their own line, apply any sequence of swaps, and you still have one person per line at the bottom. No swap can ever put two people on the same line, which is why the pairing is guaranteed to be one-to-one no matter how the rungs fall.

This holds however many rungs there are, including none at all, in which case everyone simply lands directly below where they started.

How are the rungs placed?

The ladder is as tall as twice the number of players, with a minimum of 8 rows. Every gap between two neighbouring lines is guaranteed at least one rung, so no line runs straight from top to bottom. Each remaining cell then gets a rung with a probability of 30%, subject to the rule that two rungs cannot share a row on the same line.

Across 5,000 generated ladders, a 12-player board carried between 58 and 75 rungs in 90% of cases. The randomness comes from your browser, at the moment you press the button, so whoever is running the draw has no way to aim a particular outcome at a particular person.

Is every outcome equally likely?

No. One-to-one pairing is guaranteed, but equal probability is not. Outcomes near the bottom of your own starting line come up considerably more often. This is a property of ghost legs themselves, not of this implementation.

Running the generator 5,000 times and recording where the leftmost player ended up gives the measured distribution below.

4 players, 8 rows. Roughly 30% / 27% / 24% / 19% from left to right. A uniform draw would be 25% each, so the largest deviation is about 6 percentage points.

0%12.5%25%37.5%50%1st: Share of draws landing here 29.9%1st2nd: Share of draws landing here 27.4%2nd3rd: Share of draws landing here 23.5%3rd4th: Share of draws landing here 19.2%4th
Share of draws landing here

12 players, 24 rows. The first three outcomes absorb about 60% of all draws between them, against 25% for a uniform result. The far end of the board was reached 2 times out of 5,000.

0%6.3%12.5%18.8%25%1: Share of draws landing here 21.6%12: Share of draws landing here 20.6%23: Share of draws landing here 17.4%34: Share of draws landing here 12.9%45: Share of draws landing here 11.3%56: Share of draws landing here 7.1%67: Share of draws landing here 4.7%78: Share of draws landing here 2.4%89: Share of draws landing here 1.1%910: Share of draws landing here 0.6%1011: Share of draws landing here 0.2%1112: Share of draws landing here 0.0%12
Share of draws landing here

The bias grows with the number of players, because a line has to be dragged further sideways to reach a distant outcome and each rung only moves it by one position. If you need every pairing to be equally likely, shuffle the list of outcomes before pasting it in, or use a tool that shuffles directly.

Can you predict the result from part of the ladder?

Not from a glance. Following one line means tracking every rung it meets, and a 12-player board typically has 58 to 75 of them. Miss one and you finish somewhere else entirely, which is exactly why the game works as a suspense device.

What you can do is estimate. Outcomes directly below you are more likely than distant ones, as the measurements above show. That is knowledge about the shape of the game, not about a particular ladder.

What is it good for?

  • Chores and rotas. Pair names with tasks in one draw
  • Gift exchanges. Names on one side, names on the other
  • Order of play or presentation. Outcomes become 1st, 2nd, 3rd
  • Splitting into roles. Two drivers and four passengers, say, by repeating the outcome

What it is not for is anything where the fairness has to be exact and demonstrable, such as a prize draw with real value at stake. Use a shuffle there, and see the section above for why.

The rest of the English tools are listed on the HakoTools home page. The wider Japanese site has more of the random-draw family, including a roulette wheel and a team splitter.

Why not just use paper?

Paper works, and it has one advantage: everyone watches the ladder being drawn. What it costs you is the drawing itself, the risk that whoever draws it can influence the layout, and the difficulty of tracing a line through a tangle without losing your place.

Here the rungs appear at the press of a button with nobody choosing them, the animation traces each line for you, and the pairing list at the end is there to copy. Redrawing costs nothing, which is useful when someone joins late.

Notes

  • Between 2 and 12 names, and the same number of outcomes
  • Blank lines are ignored, so a trailing newline is harmless
  • Once a line has been traced its result is fixed. Drawing again produces a new ladder, so agree on the ladder before anyone starts following lines
  • Names and outcomes are processed in your browser only. Nothing is stored, and reloading the page clears everything

Frequently asked questions

What is a ghost leg?
A drawing game from Japan, where it is called amidakuji. You draw one vertical line per person, connect neighbouring lines with random horizontal rungs, and follow your line downwards, taking every rung you meet. Everyone lands on a different outcome.
Does everyone have an equal chance of any outcome?
No, and this is worth knowing. The pairing is always one-to-one, so no outcome is ever handed out twice. But with randomly placed rungs your starting position affects where you are likely to land: outcomes near the bottom of your own line come up far more often. With 12 players the leftmost one reaches the first outcome roughly 22% of the time instead of 8.3%. Shuffle your list of outcomes before pasting it if that matters.
How many people can take part?
Between 2 and 12. The number of outcomes has to match the number of names, one per line in each box.
Can the person running it rig the result?
Not by choosing the rungs, because they are placed by the browser's random number generator when you press the button. They can of course draw again, so agree on the ladder before anyone follows a line.
Share this tool: