The Wheel Spinner

Transparent & Fair Random Drawing

How TheWheelSpinner.com guarantees mathematically unbiased results for every spin.

1. Cryptographic Entropy Source

Many online wheel spinners rely on the browser's standard Math.random() function. While suitable for basic animations, Math.random() is a Pseudo-Random Number Generator (PRNG) that is not cryptographically secure and can display patterns or predictability over repeated trials.

We utilize the browser's native **Web Crypto API** (window.crypto.getRandomValues) to generate 32-bit unsigned integers. This pulls high-entropy randomness directly from the operating system's secure entropy pools (such as hardware noise or kernel events), making it impossible for users, streamers, or observers to predict or manipulate drawing outcomes.

2. Eliminating Modulo Bias with Rejection Sampling

A common mathematical error in random pickers is reducing a large random number using a simple modulo operation (e.g. randomUint32 % totalSlices). Because the range of a 32-bit unsigned integer ($2^{32} = 4,294,967,296$) is rarely a perfect multiple of the number of slices on the wheel, certain slices would naturally receive a slightly higher probability of landing than others. This is known as **modulo bias**.

To prevent this bias, we implement **rejection sampling**:

const limit32 = 4294967296; // 2^32
const maxMultiple = limit32 - (limit32 % totalSlices);

let R;
do {
  R = getRandomUint32();
} while (R >= maxMultiple);

const winnerIndex = R % totalSlices;
    

Any random number falling above the largest perfect multiple of the slice count is rejected, and a new random value is generated. This ensures that every slice has exactly identical odds, down to the last decimal place.

3. Cumulative Weighted Selection

For wheels configured with custom weights, we select the winning slice using a deterministic cumulative weight boundary model. We generate a uniform random double $r \in [0, 1)$ without bias via $r = R / 4294967296$. We compute the total sum of weights $W$, and define a target $T = r \cdot W$. The winning slice is the index $k$ satisfying:

$\sum_{i=0}^{k-1} w_i \le T < \sum_{i=0}^{k} w_i$

This represents a strict left-closed, right-open mathematical interval, establishing clear boundaries with no overlap.

4. Pre-determined Selection Physics

**Crucial Product Rule**: The winner is selected before the visual animation begins. Once the winner index is determined cryptographically, we calculate the exact target angle needed to stop the wheel on that slice. The deceleration curve is governed by a cubic ease-out function:

$f(t) = 1 - (1 - t)^3$

The visual spin strictly displays the result that was already selected. The animation never determines, guides, or alters the winning choice.

Verify It Yourself

We believe trust is earned through transparency. You can open the developer console or view our offline test suite:

  • Automated Statistical Tests: Runs 100,000 trials on the selection engine using a Chi-Square goodness-of-fit test to verify that the selection rate matches the configured probabilities.
  • Geometry Property Tests: Automatically runs 1,000 mock spins with up to 500 slices, confirming that the computed landing angle always falls within the boundaries of the pre-calculated winner.

Note: Statistical tests validate that our implementation is mathematically unbiased and mathematically sound, but they do not themselves prove the raw cryptographic entropy of the browser API.