Why Standard JavaScript Wheels Are Mathematically Biased
Most online wheel spinners rely on Math.random(), which employs pseudo-random algorithms like xoshiro128+ or v8's internal PRNG. While sufficient for casual animations, applying standard modulo arithmetic (Math.floor(Math.random() * N)) induces modulo bias. Because the range of possible floating-point numbers does not divide evenly into arbitrary slice counts $N$, earlier slices have a slight statistical preference over later slices.
How SpinTheWheelOut Guarantees Mathematical Fairness
SpinTheWheelOut completely eliminates modulo bias and PRNG predictability by adopting the two industry gold standards for cryptographic random generation:
- Hardware-Backed Entropy (
crypto.getRandomValues): Instead of software-seeded math, we sample true cryptographic entropy directly from your CPU's hardware random number generator (Intel RDRAND, AMD Hardware RNG, or Apple Secure Enclave). - Unbiased Rejection Sampling: When mapping a 32-bit unsigned integer ($0$ to $2^{32}-1$) to $N$ wheel slices, any raw value falling into the incomplete remainder range above $\lfloor 2^{32} / N \rfloor \times N$ is strictly rejected and re-sampled. This ensures that every slice has an identical, mathematically uniform probability down to the exact bit.
Chi-Square (χ²) Goodness-of-Fit Test
The interactive benchmark above subjects our rejection sampling engine to the Pearson's Chi-Square Goodness-of-Fit test:
χ² = ∑ [ (Oi - Ei)² / Ei ]
For a 6-slice wheel with 5 degrees of freedom at a critical threshold of α = 0.05, any χ² value below 11.07 confirms that the observed frequencies match the theoretical expected uniform distribution. At 10,000 draws, our engine consistently produces scores well below this threshold.