Seeded simulation clock driving deterministic probe sampling. More...
| Import Statement: | import Clayground.Lab |
The heart of the determinism contract: all lab randomness must come from this clock's seeded generator, and probes are sampled on a fixed sim-time grid. With a world assigned, sim time advances with the physics steps (exact under the inspector's time/step action); without one, a frame ticker advances it, honoring Clayground.paused and Clayground.timeScale.
Example usage:
import Clayground.Lab SimClock { id: clock; seed: 42; world: theWorld }
fixedStep : real |
maxStepsPerAdvance : int |
Fixed steps allowed per advance, so a hitch cannot become a freeze.
sampleInterval : real |
Sim-time seconds between probe samples.
seed : int |
Seed for the deterministic random generator; changing it resets the clock.
time : real |
Simulated seconds since the last reset.
timeScale : real |
Slow-motion/fast-forward factor for live (frame-driven) mode.
Composes with Clayground.timeScale; ignored while stepping, which always advances fixed frames for reproducibility.
world : var |
Optional ClayWorld2d; when set, time advances with physics steps.
stepped(real dt) |
wasReset() |
Emitted after a reset; sensors/estimators snap their state here.
Note: The corresponding handler is onWasReset.
real random() |
Deterministic uniform random number in [0, 1) (mulberry32).
real randomGaussian() |
Deterministic standard-normal random number (Box-Muller).
real randomRange(real from, real to) |
Deterministic uniform random number in [from, to).
void reset() |
Resets time, random state and all probe samples.