Chaos Game Fractal Generator
Draw the Sierpinski triangle and its relatives by repeatedly jumping halfway towards a randomly chosen vertex, and see how restriction rules change which fractal appears.
Last reviewed by the Radiatus Cloud team
Need this done properly for your business?
Radiatus delivers secure cloud, DevOps & compliance engineering.
Random moves converging on a fixed shape
Pick three points, start anywhere, then repeatedly choose a vertex at random and move halfway towards it, marking each position. After a few thousand points the Sierpinski triangle appears, and it appears every time regardless of where you started or which random numbers you got. The randomness decides the order in which the picture fills, not what the picture is: the shape is the attractor of the transformations, and any sequence of them converges to it.
The jump fraction determines the shape
Moving halfway towards a vertex of a triangle gives the Sierpinski gasket. The jump fraction is how far you move, so the contraction ratio is one minus it. Below one half the copies are larger than the gaps between them and overlap, filling the holes in; above one half they shrink apart and the figure becomes dust. For a square, jumping halfway gives a solid square with no structure at all, and structure only returns when a rule forbids choosing the same vertex twice in a row. That single restriction produces an entirely different figure.
The first points must be discarded
The starting point is generally not on the attractor, and the first several iterations trail towards it from wherever they began. Plotting them leaves a faint line of points that belong to no part of the fractal, which is why implementations discard the first ten or twenty. It is a small detail and it is the difference between a clean figure and one with a visible artefact leading in from the corner.
Related tools
- Data Collection Analysis — Analyze app description to infer data collection.
- Dark Pattern Detector — Scan UX text for manipulative patterns.
- AI Risk Disclosure — Generate disclosure text for AI features.
- Maturity Radar — Generate a radar chart of security maturity.
Frequently Asked Questions
Why does a random process give a fixed shape?
Because the shape is the attractor of the transformations. Any sequence of them converges to it, so randomness decides the order the picture fills in rather than what it is.
What happens if I change the jump fraction?
The contraction ratio is one minus the fraction. Below one half the copies overlap and the holes fill in; above one half they separate into dust. One half is the value at which the copies exactly touch.
Why does a square give no pattern?
Because jumping halfway towards four corners covers the square uniformly. Structure returns when a rule forbids repeating a vertex, which changes which regions can be reached.
Why discard the first points?
Because the starting point is generally not on the attractor and the first iterations trail towards it, leaving a line of points belonging to no part of the fractal.
Is this the same as an iterated function system?
Yes. The chaos game is the random iteration algorithm for an IFS, and the Barnsley fern is the same method with four weighted affine transformations rather than uniform jumps to vertices.
Privacy & Security
Everything runs in your browser; nothing is uploaded.
How to Use
Choose the vertex count and jump fraction, then run.
Disclaimer: This tool is provided "as is" without warranty of any kind. Results are for educational and utility purposes.