after-hours RNG · cryptography · cellular automata

The playground.

Small things, built honestly. The math here is real even when the toys are silly. Most of these double as live demos for the statistical-testing kit one click away.

If you'd like to sit and stare, here's Conway's Game of Life as a fullscreen stage, or just animated as the background.

side door · live reaction trainer

F1-style reaction timer

Five lights, random hold, lights-out, react. Jump-start detection, persistent best score in localStorage. Under 200 ms is pro-driver territory. Anything claiming under 150 ms is probably you anticipating.

tool 01

Password generator

Pulls bytes from window.crypto.getRandomValues() (the browser CSPRNG, suitable for security-sensitive use) with rejection sampling so the modulo doesn't bias the character distribution. Falls back to Math.random() only if crypto is unavailable.

Modern V8/SpiderMonkey implement Math.random() with xorshift128+, so the output is statistically high quality — but it is not cryptographically secure: the internal state can be reconstructed from a handful of outputs. Don't use it for tokens, secrets, or anything an attacker would benefit from predicting.

tool 02

Array shuffler

Fisher-Yates shuffle backed by a uniform integer generator on top of crypto.getRandomValues() (with rejection sampling so each of the $n!$ permutations is equally likely). Takes a comma- or space-separated list and returns a fair shuffle.

visual 01

Math.random() plot

Points $(x, y)$ where both coordinates come from Math.random(). The plot runs in \(\mathcal{O}(n)\) per call — constant work per sample.

With $n = 250$ points the four quadrants of $[0,1]^2$ won't have exactly the same count even from a perfect uniform RNG; that's a property of random sampling, not a flaw of the generator. The Law of Large Numbers makes the imbalance shrink as $n$ grows.

visual 02

32-bit XORShift plot

Same plot, but using a small xorshift generator (Marsaglia 2003) seeded once from crypto.getRandomValues(). It's the x ^= x << 13; x ^= x >> 17; x ^= x << 5; recurrence — fast, statistically decent at short lengths, and a useful baseline for comparison.

For full statistical evaluation, use the NIST-style testing kit.

notes

Inline math sanity check

This page uses MathJax for inline LaTeX. Right-click any equation for an alternate- rendering dialog if your browser is having a bad time.

Inline: \( x^2 + y^2 = z^2 \).  Displayed:

\[ \int_0^\infty e^{-x^2}\, dx = \frac{\sqrt{\pi}}{2} \]