Skip to main content
🔐 Transparency, Fairness & E-E-A-T

Is the Randomness Real? Algorithm & Transparency

In a classroom raffle, commercial contest, or high-stakes tabletop session, trust is everything. Here is an in-depth breakdown of the mathematics, code, and cryptographic architecture that ensure every outcome on Wheel Spinner is 100% mathematically pure, unbiased, and tamper-proof.

Live Cryptographic Entropy Inspector

Your Device

Click the button below to request a batch of cryptographic random numbers directly from your device’s hardware using crypto.getRandomValues:

32-bit Integer (Dec):Click button to generate
Hexadecimal representation:-
Continuous float [0, 1):-

1. The Problem with Weak Randomness on the Web

The vast majority of online spinner and dice websites rely on JavaScript's standard Math.random() method. While perfectly acceptable for cosmetic animations (such as floating confetti particles or randomized star twinkling), it is fundamentally unfit for fair raffles, gaming, or dispute resolution.

Math.random() is a pseudo-random number generator (PRNG) typically powered by algorithms like xorshift128+. These algorithms compute each successive number based on the internal state of the previous one. If an observer collects a modest sequence of past outputs, the generator's internal state can be mathematically reverse-engineered, rendering future outcomes predictable.

"For a school giveaway, a contest, or a tabletop roll, a predictable generator destroys the fundamental foundation of fairness."

2. Our Solution: The Web Cryptography API (CSPRNG)

On Wheel Spinner, we completely replaced Math.random() with the W3C standard cryptographic interface: window.crypto.getRandomValues().

This method hooks directly into the host operating system's cryptographic entropy subsystem (such as /dev/urandom on Linux, macOS, and Android, or BCryptGenRandom on Windows). The entropy originates not from repetitive mathematical loops, but from true physical hardware phenomena:

  • Thermal fluctuations and processor clock jitters in your CPU.
  • Nanosecond-precision timings of hardware interrupts and disk read/write events.
  • Ambient system noise from network controllers and input peripherals.

3. The Danger of "Modulo Bias" and How We Eliminate It

Even when utilizing cryptographic entropy, many online tools commit a major mathematical error when constraining large integers to a specific range using the remainder operator (modulo %).

An unsigned 32-bit integer encompasses $2^32 = 4,294,967,296$ possible states (from 0 to $4,294,967,295$). If you want a number between 1 and 6 for a die and calculate buffer[0] % 6, an imbalance arises: $4,294,967,296$ does not divide evenly by 6 (leaving a remainder of 4).

Consequently, the numbers 0, 1, 2, and 3 have exactly one additional possibility of being rolled compared to 4 and 5. Over millions of rolls, this introduces an uneven statistical slant.

🛡️
Zero Modulo Bias via Rejection Sampling

To achieve absolute statistical purity, we implement rejection sampling: we determine the highest exact multiple of the requested range that fits within $2^32$ and discard any random value that falls into the surplus remainder, drawing a fresh cryptographic sample immediately. This guarantees an exact 0.000000% modulo bias.

4. Auditable Open Source Implementation

Below is the exact TypeScript implementation that your browser executes for every wheel spin, coin toss, and dice roll across this website:

src/utils/random.tsJavaScript / TypeScript
/**
 * Wheel Spinner - Rejection Sampling Algorithm (Zero Modulo Bias)
 * Guarantees 100% uniform probability between min and max.
 */
function getRandomInt(min, max) {
  const range = max - min + 1;
  const buffer = new Uint32Array(1);

  // Maximum valid threshold evenly divisible by range in 32-bit integer space (0 to 2^32 - 1)
  const maxValid = 0x100000000 - (0x100000000 % range);

  let rawValue = 0;
  do {
    // True hardware cryptographic entropy from the operating system
    window.crypto.getRandomValues(buffer);
    rawValue = buffer[0];
  } while (rawValue >= maxValid); // Rejects values causing modulo bias

  return min + (rawValue % range);
}

5. Technical Comparison: Math.random() vs. Wheel Spinner

Technical ParameterStandard WebsitesWheel Spinner (Cryptographic)
Base generatorStandard Math.random()window.crypto.getRandomValues()
Entropy sourceSystem clock / internal seed stateOS hardware entropy (CPU thermal noise /dev/urandom)
PredictabilityPredictable once prior states are observedCryptographically unpredictable (CSPRNG)
Modulo biasCommon (direct % range usage)Zero modulo bias (rejection sampling)
Bit resolutionLimited to ~32 bits approximationFull 53-bit IEEE 754 precision entropy
Auditable in F12 DevToolsDifficult to verify fairness100% open and verifiable in your browser

6. Zero Server Communication: 100% Client-Side Privacy

On platforms where outcomes are calculated on a remote backend server via AJAX or WebSocket requests, participants have no way of knowing whether the host server favored a particular user ID or manipulated the results.

On Wheel Spinner, the entire calculation executes 100% inside your local device's memory. In fact, you can disconnect your internet connection entirely after loading the page, and the wheels, coins, and dice will continue to function with identical cryptographic precision. Your lists, names, and selections are never uploaded or transmitted to any external server.

Common Inquiries

Transparency & Security FAQs

Can the site owner alter or rig a roll or spin result?

No. All randomness logic executes exclusively within your device’s browser (client-side) using native JavaScript. No external server, remote database, or third-party API is consulted during a spin or roll, making remote tampering technically impossible.

How can I verify for myself that the code is fair and unrigged?

Anyone can open their browser developer tools (press F12 or right-click > Inspect), locate the client-side JavaScript source files, and inspect the code directly. You will see that the functions call crypto.getRandomValues with rejection sampling, completely free of hidden cookies, weights, or backdoor logic.

Why don't you simply use Math.random() like other websites?

Math.random() uses pseudo-random number generator algorithms (such as xorshift128+) that are mathematically deterministic and vulnerable to seed reconstruction. The Web Cryptography API taps directly into the operating system's hardware entropy pool (processor thermal noise, microsecond hardware interrupt timing), providing true non-predictable cryptographic randomness.

What is modulo bias and how does this engine eliminate it?

When converting a large 32-bit random integer to a specific range using the modulo operator (%), smaller numbers gain a slight mathematical edge if the range does not divide evenly into 2^32. We eliminate this flaw entirely via rejection sampling, discarding any raw values that fall into the incomplete upper remainder.