Randomness Audit
See exactly how the wheel picks a winner, the math behind the fairness check, and run a live statistical audit using the same random source the wheel uses.
How the winner is chosen
In normal mode (no cheat mode, no weighted visuals) the winning slice is decided before the animation starts, using this sequence:
- 1A uniform random angle is drawn: targetMod = Math.random() × 360, giving a value uniformly distributed over [0°, 360°).
- 2The wheel is rotated so that angle lands under the fixed top pointer, plus 5–8 extra full turns for the visual effect.
- 3The easing curve (cubic-bezier) only controls how fast the wheel slows — it does not influence which slice wins.
- 4The winning index is read directly from the final angle: idx = ⌊(360 − rotation) / segAngle⌋ mod N.
Because Math.random() is uniformly distributed, every slice of equal angular width has exactly the same probability of being selected: 1 / N. The animation is purely cosmetic.
The mathematics: chi-square goodness-of-fit
To test whether observed results match a uniform distribution, we use the chi-square goodness-of-fit test:
- Oi — observed count for slice i (how many times it actually won)
- Ei — expected count for slice i = total trials / N
- df — degrees of freedom = N − 1
- p-value — probability of seeing a χ² this large if the source is truly uniform
A high p-value (≥ 0.05) means the observed counts are consistent with a fair, uniform random source. A low p-value suggests bias — though even a fair wheel will occasionally fail one run by pure chance, which is why the test should be repeated.
Run a live audit
This runs the wheel's actual selection function right in your browser, using the same Math.random() call. Pick a wheel size and sample count, then run it.