Skip to main content
Mechanical Engineering 6 min read 2026-11-12

Inside the Drum: How crypto.getRandomValues Drives Every Reel Stop

By Fiona MacLeod, Lead Client Systems Engineer

Inside the Drum: How crypto.getRandomValues Drives Every Reel Stop geometric diagram

Why Ordinary Pseudo-Random Generators Fall Short

Many casual browser toys reach for JavaScript’s built-in Math.random() without a second thought. While convenient, classic floating-point generators rely on short internal state seeds and offer no cryptographic unpredictability guarantees. When we built the ES6 cabinet engine for Golspie Pier, we treated our virtual reel stops with the same precision an optician brings to a vernier bezel: every single symbol selection uses the browser’s native Web Crypto API via window.crypto.getRandomValues().

Operating directly on unsigned 32-bit integers sourced from the operating system’s entropy pool eliminates predictable cycles. Even better, because all execution happens transparently inside your own browser, there is no remote black-box server silently throttling outcomes behind the curtain.

Eliminating Modulo Bias with Rejection Sampling

Drawing a random 32-bit integer is only half the engineering job. If a symbol weight table sums to, say, 103 total weight units, taking a raw integer modulo 103 introduces a tiny bias toward lower remainders because 2^32 is not evenly divisible by 103. Our core VaultManager and ReelCabinet classes therefore apply strict rejection sampling: any raw 32-bit value falling in the incomplete upper remainder band is discarded and redrawn immediately.

The result is a mathematically uniform integer across [0, totalWeight - 1]. Each cell on a 5x3, 5x4, 6x4, or 3x3 tray is drawn independently against that bench’s published symbol weights—no hidden memory, no streak steering, and no rank-based weighting.

Independence Across Spins and Ranks

One persistent myth around reel mechanics is that a cabinet becomes "due" after several quiet spins, or that climbing from Apprentice Grinder to Master Lenswright tilts the brass drums in your favour. Neither is true here. Every press of Spin clears the slate completely: the probability of landing three Aurora Lenses on spin 51 is identical to spin 1.

Cosmetic ranks and Workshop Tasks exist solely to celebrate exploration across the five terraces. If you ever want to audit the behaviour yourself, your Workbench keeps a live 60-round local log—and you can export your entire local profile as readable JSON at any moment.

Continue Reading the Fieldbook