Code and Gravity

Deterministic physics: why our simulations never change

A simulation is deterministic when the same starting values always give the same result. We get this by using a seeded random generator instead of true randomness and by advancing the physics in fixed 1/60 second steps.

Random, but repeatable

Computers make "random" numbers with a formula that starts from a number called a seed. Give it the same seed and it produces the same sequence. The ball launch and the ring gap positions come from this sequence, so a seed fully decides the run.

A fixed time step

If a simulation advances by however long the last frame took, a slow computer gets different results from a fast one. Ours always advances exactly 1/60 of a second per step, however fast your screen refreshes.

Why it matters

It lets us check every video automatically, find a seed whose big moment lands at the right second, and render the final video offline frame by frame. It also lets you share a run: the same link shows the same ball path on any device.

The limit

Tiny differences in how browsers do floating-point maths can in theory change a run after a very long time. Every video is rendered once on one machine, so the published video is always consistent.

Questions

What is a random seed?
A starting number for a random-number formula. The same seed always produces the same sequence of "random" numbers.
Can I try different seeds?
Yes. Open the Play page, change the seed and watch a different run.

Try it: open in the sandbox →

By Code and Gravity · 2026-10-23

More to learn