RReal Randomizer
Fair Randomness5 min read•By Real Randomizer Editorial•Updated Nov 8, 2026

What Makes an Online Randomizer Fair? The Math of CSPRNG, Modulo Bias & Provably Fair Draws

How computers generate true unpredictability, the mathematical proof of modulo bias with rejection sampling, and a step-by-step verification checklist for giveaways.

What Makes an Online Randomizer Fair? The Math of CSPRNG, Modulo Bias & Provably Fair Draws featured illustration
Interactive Simulator

Modulo Bias vs. Rejection Sampling

Simulate picking 3 choices (Outcome 0, 1, 2) from an 8-sided source (values 0–7). See how modulo math artificially biases outcomes vs cryptographic rejection sampling.

Outcome 0
37.5%(theory: 37.5%)
0 / 0 hits
Inputs: 0, 3, 6 (3 chances)
Outcome 1
37.5%(theory: 37.5%)
0 / 0 hits
Inputs: 1, 4, 7 (3 chances)
Outcome 2Cheated!
25.0%(theory: 25%)
0 / 0 hits
Inputs: 2, 5 (Only 2 chances!)
Quick Takeaway

A fair randomizer guarantees every available choice has the exact same probability of being chosen: P(X = x) = 1/N. Real Randomizer calculates winning outcomes instantaneously using cryptographic hardware entropy before any visual animation starts. Spinning wheels and rolling dice simply present the result—they never alter or determine the math!

The Mathematical Definition of True Fairness

In statistics, a fair discrete selection follows a discrete uniform distribution. If you have N distinct items (contestants, names, raffle tickets, or numbers), each item must have an identical mathematical probability of being selected:

The Uniform Probability Formula
P(X = x_i) = 1 / N  for all i ∈ {1, 2, ..., N}

Where N is the total count of eligible entries. No item may have an odds advantage, and no entry may be excluded or weighed down unless explicitly designated as a weighted draw.

To achieve this digitally, an algorithm must fulfill three strict criteria:

  1. Unpredictability: No observer—even someone inspecting the webpage's source code—can deduce the next outcome from past outputs.
  2. Uniform Spread: Over thousands of draws, each outcome appears with equal frequency without clustering around particular numbers.
  3. Zero Tampering: Results cannot be recalculated, intercepted, or re-rolled behind the scenes.

Pseudo-Randomness vs. Cryptographic Security (CSPRNG)

Many basic web applications use the standard JavaScript function Math.random(). While suitable for harmless video games or visual particle effects, Math.random() relies on algorithms like xorshift128+. These are pseudo-random number generators (PRNGs). They are deterministic: if an observer captures a small sequence of outputs, they can reverse-engineer the internal internal state and accurately predict every future output!

Common Developer Pitfall

Never rely on Math.random() for raffles, cash giveaways, passwords, or audits. Because its seed state is predictable, tech-savvy users can script bots to enter at precise moments or exploit known PRNG output cycles.

Real Randomizer relies exclusively on the browser's native Web Crypto API (window.crypto.getRandomValues). This is a Cryptographically Secure Pseudo-Random Number Generator (CSPRNG). It gathers genuine hardware entropy directly from your operating system—such as CPU clock jitter, thermal noise, and hardware interrupt timings. Its outputs are mathematically indistinguishable from pure cosmic noise.

The Hidden Flaw: Modulo Bias & Rejection Sampling

Even with a high-grade cryptographic random source, poorly engineered code can introduce an invisible mathematical error known as modulo bias.

Consider an intuitive example: You have an 8-sided die with faces numbered 0 through 7. You want to pick randomly between 3 choices: Option 0, Option 1, or Option 2. A developer might take the die roll and use the modulo (remainder) operator: outcome = roll % 3.

Look at what happens to the probabilities:

Raw Roll (0–7) Modulo 3 Outcome Total Chances Exact Probability
Rolls 0, 3, 6 Option 0 3 ways 3 / 8 = 37.5%
Rolls 1, 4, 7 Option 1 3 ways 3 / 8 = 37.5%
Rolls 2, 5 Option 2 2 ways (Cheated!) 2 / 8 = 25.0%

Option 2 has a 25% chance, while Options 0 and 1 each have 37.5%! Option 2 is cheated out of 33% of its rightful odds! When developers take a 32-bit random integer (range 0 to 4,294,967,295) and scale it down with % N, the exact same skew occurs unless the range divides evenly into $2^{32}$.

The Fix: Rejection Sampling

Real Randomizer eliminates modulo bias using rejection sampling. If a raw drawn value falls into the uneven remainder margin at the ceiling of the integer range, the algorithm immediately rejects it and draws a fresh value. Every single choice receives an uncompromised, identical probability.

Why the Animation Doesn't Pick the Winner

When you spin our Spin the Wheel or roll our Dice Roller, you see smooth 60fps animations, physics decelerations, and audio clicks. It creates great suspense! But in reliable software engineering, there is a core rule:

The winner is calculated cryptographically the exact millisecond you press the button.

The visual animation is strictly a presentation layer. If the outcome depended on where an animation stopped spinning, a frame-rate stutter, a low battery throttle, or browser tab switching could physically bias the outcome. Calculating the result beforehand guarantees your draw is 100% immune to hardware lag.

Wheel vs. List Picker: Which Should You Use?

Feature Spin the Wheel Random Name / Winner Picker
Ideal List Size 2 to 30 items 2 to 10,000+ entries
Simultaneous Winners 1 winner per spin 1 to 50+ winners in one click
Atmosphere & Experience High drama, ticking audio, live stream suspense Clean, rapid, distraction-free audit results
Slice Weighting Supported (custom chances per wedge) Purely equal probability
Recommended Tool Spin the Wheel Random Winner Picker

The Host's Provably Fair Draw Checklist

If you are hosting a social media giveaway, classroom raffle, or corporate contest, follow this 4-step checklist to ensure total credibility:

  1. Lock and publish rules before opening entries: State eligibility, deadline timezone, number of winners, and the claim window (e.g., 48 hours).
  2. Sanitize your roster: Remove blank lines, accidental double-spaces, and duplicate entries using our list tools.
  3. Capture an uncut screen recording: Show your browser address bar, the entry count, and your system clock in one continuous video cut.
  4. Pre-draw backup runners-up: Always draw 1 or 2 alternate winners during the initial session. If a primary winner fails to claim, contact Alternate #1 without needing a messy secondary draw.

Frequently Asked Questions

Can an online randomizer be inspected or hacked?

Because Real Randomizer generates outcomes in volatile memory via crypto.getRandomValues, no user can manipulate future outcomes by inspecting the console or altering DOM elements.

Does Real Randomizer store my entrant names?

No. Our tools execute 100% client-side inside your browser. No lists, names, or rosters are ever transmitted to or stored on remote servers.

Related Topics:#fairness#web crypto#random numbers
Instant Solution

Spin the Wheel

Put this math into practice right now. Safe, free, and runs 100% locally in your browser.

Open Free Tool →