A fractal from coin flips
The chaos game is one of the strangest results in mathematics: pick a few fixed points (vertices of a polygon), start anywhere, and repeatedly jump partway toward a randomly chosen vertex. Plot every point you land on. Despite the randomness at every single step, the accumulated dots do not form a formless blur — they trace out a precise, infinitely detailed fractal. For a triangle with a jump ratio of one-half, the result is the Sierpiński triangle, the same shape you get from the fully deterministic, non-random recursive construction of repeatedly removing the middle triangle.
pick 3 vertices: A, B, C
start at any point P
repeat forever:
choose a vertex V at random (A, B or C)
P = P + 0.5 * (V - P) // jump halfway toward V
plot P
This was popularised by mathematician Michael Barnsley in the 1980s as a vivid, hands-on illustration of an iterated function system (IFS) — a set of contraction maps (here, three "jump halfway toward vertex" rules) whose repeated random application converges to a unique fixed shape called the attractor, regardless of where you start. The starting point only affects the very first few dots; wait long enough and every run converges onto the identical fractal.
Why the middle never fills in
The reason a hole appears at the centre of the triangle is purely combinatorial: jumping halfway toward any one of three vertices can never land you in the central region, no matter which sequence of vertices you choose, because that region is only reachable by paths that the halfway rule forbids. Run the process long enough and the density of dots reveals self-similar copies of the whole triangle inside each of its three corners, and inside each of those, forever — the defining property of a fractal.
Other shapes from the same idea
Changing the jump ratio, the number of vertices, or adding rules (like "never choose the same vertex twice in a row") produces an entire family of related fractals from the same basic engine. A square with a half-ratio jump just fills in solidly (there is no forbidden region), but restricting which vertex can follow which produces intricate patterns again. The Vicsek fractal comes from five points (four corners plus the centre of a square) with a jump ratio of one-third. The famous Barnsley fern — a strikingly realistic fern frond — uses four affine transformations (each a small stretch, rotation and shift) applied with different, carefully tuned probabilities rather than a simple uniform vertex choice, showing that the chaos-game idea generalises far beyond straightforward polygons.
Sierpiński triangle: 3 vertices, ratio 1/2 Vicsek fractal: 5 points (corners + centre), ratio 1/3 Barnsley fern: 4 weighted affine maps, probabilities tuned by hand
The deep idea: order hides inside randomness
The chaos game is a small, visual proof that a process built entirely from independent random choices can still have a completely deterministic, reproducible long-run outcome. This is closely related to why Monte Carlo methods work in physics and finance: individual samples are random, but their statistical distribution converges reliably to a fixed answer. It is also a gentle introduction to ergodic theory, the branch of mathematics that studies when the long-run average behaviour of a random or chaotic system settles into a stable pattern independent of its starting conditions.
Frequently asked questions
Does the starting point change the final fractal?
No. The starting point only influences the first handful of plotted dots, which are usually not even visible once thousands of points accumulate. Every run of the chaos game with the same vertices and jump ratio converges to the identical attractor shape.
Why is it called the chaos game if the result is so orderly?
Because each individual step is genuinely random — you cannot predict which vertex will be chosen next, or exactly where the next point will land. The name highlights the surprise that a random, unpredictable process still produces a precise, repeatable fractal shape over the long run.
What happens if you use a jump ratio other than one-half for a triangle?
A ratio below one-half produces a smaller, more sparse-looking Sierpiński-like fractal with different scaling, while a ratio of exactly one-half gives the classic Sierpiński triangle. Push the ratio close to one and the points barely move, converging slowly toward whichever vertices get chosen; the specific self-similar structure depends on the exact ratio chosen.
Try it live
Everything above runs in your browser — open Chaos Game and change the parameters while it is running. Nothing is installed, nothing is uploaded, the whole model lives in one tab.
▶ Open Chaos Game simulation