A double-jointed robot arm is a classic chaotic system: two coupled pendula whose motion is described by the Lagrangian equations
θ1'' = [-g(2m1+m2)sinθ1 - m2 g sin(θ1-2θ2)
- 2 sin(θ1-θ2) m2 (θ2'² L2 + θ1'² L1 cos(θ1-θ2))]
/ [L1 (2m1+m2 - m2 cos(2θ1-2θ2))]
θ2'' = [2 sin(θ1-θ2) (θ1'² L1(m1+m2) + g(m1+m2) cosθ1
+ θ2'² L2 m2 cos(θ1-θ2))]
/ [L2 (2m1+m2 - m2 cos(2θ1-2θ2))]
Tiny differences in joint angle grow exponentially (positive Lyapunov exponent), so the low-order bits of the elbow angle θ2 are practically unpredictable even though the equations are fully deterministic — exactly the property real mechanical/chaotic-pendulum TRNGs exploit as a physical entropy source, instead of relying on a software pseudo-random generator. (These equations were re-derived and numerically cross-checked bit-for-bit against the 3D version of this simulator before shipping; no correction was needed — the source Lagrangian form is internally consistent.)
Every sample interval, the harvester reads the least-significant bit of θ2 (scaled to high precision) as one raw bit. Raw physical entropy sources are usually biased (more 0s than 1s or vice versa), so the stream is optionally passed through a Von Neumann extractor: bits are read in pairs — 01 → output 0, 10 → output 1, 00 and 11 → discarded. This provably removes any first-order bias regardless of the source's skew, at the cost of throwing away roughly half the raw bits.
- Chaos drive — random torque injected at the elbow joint each frame; higher values push the arm through wider, faster excursions and increase raw entropy.
- Sample interval — how often one raw bit is harvested from θ2; shorter intervals raise throughput but correlate consecutive samples more, which is why debiasing still matters.
- Debiasing toggle — turn it off to see the raw Shannon entropy sag toward 0 bit when the arm settles into a shorter excursion; turn it on to see the extractor pull the output stream back toward 1 bit/sample.
- Phase-space panel — plots θ₂ (wrapped to −π…π) against ω₂ every frame with a fading trail; a chaotic system never closes into a simple loop here, which is a visual signature of the positive Lyapunov exponent driving the entropy.
- Key box — the debiased bitstream, packed 4 bits at a time into a growing hexadecimal key, exactly as a hardware RNG feeds a key-derivation function.