When you spin a wheel online, you expect the result to be random and fair. But not all randomness is created equal. Most websites use Math.random(), a built-in JavaScript function that generates pseudo-random numbers. While these numbers appear random on the surface, they are actually produced by a deterministic algorithm. If someone knows the internal state of the generator, they can predict every future output.
Roulety takes a fundamentally different approach. Instead of Math.random(), it uses the Web Crypto API — specifically, window.crypto.getRandomValues(). This function is designed for cryptographic applications where unpredictability is not just desirable but essential, such as generating encryption keys, secure tokens, and digital signatures.
How the Web Crypto API Works
The Web Crypto API draws its randomness from the operating system's entropy pool. Entropy is a measure of genuine unpredictability, and it comes from physical sources that are inherently chaotic: the precise timing of keystrokes, mouse movements, disk I/O operations, network packet arrival times, and even thermal noise in hardware components.
The operating system continuously collects these tiny, unpredictable events and mixes them together using cryptographic algorithms (like ChaCha20 or AES in counter mode) to produce a stream of random bytes. When a web application calls crypto.getRandomValues(), the browser requests random data from this pool, producing numbers that are computationally indistinguishable from true randomness.
Why This Matters for a Spinner Wheel
For a casual spinner wheel, you might wonder if this level of randomness is overkill. Here is why it matters:
Fairness and Trust — When you use a spinner wheel for a giveaway, classroom activity, or team decision, the participants need to trust that the result is fair. With cryptographic randomness, no one — not even the person who set up the wheel — can predict or influence the outcome.
No Patterns — Pseudo-random generators can exhibit subtle patterns over large numbers of spins. For example, Math.random() in some JavaScript engines produces numbers with slight biases in certain bit positions. Cryptographic generators are specifically designed and tested to avoid any such patterns.
Resistance to Manipulation — In competitive contexts like giveaways with real prizes, the integrity of the random selection is critical. Cryptographic randomness ensures that the result cannot be reverse-engineered or tampered with.
The Technical Details
When Roulety needs to determine where the wheel lands, it generates a random 32-bit unsigned integer using crypto.getRandomValues(new Uint32Array(1)). This produces a number between 0 and 4,294,967,295, which is then mapped uniformly to a position on the wheel. The mapping is done carefully to avoid modulo bias — a common pitfall where certain outcomes become slightly more probable than others when the range of the random number generator is not evenly divisible by the number of wheel segments.
Conclusion
True randomness might seem like a small detail, but it is the foundation of a fair and trustworthy spinner wheel. By using the Web Crypto API, Roulety provides the strongest guarantee of fairness available in a web browser — the same level of randomness that protects your online banking, encrypted messages, and secure connections. Every spin is as fair as technology allows it to be.
Recommended Reading
If you found this article useful, these books go deeper into the same topics. Each title is hand-picked for the material covered above.
- Serious Cryptography: A Practical Introduction to Modern Encryption by Jean-Philippe Aumasson — A modern, approachable treatment of how cryptographically secure randomness is built and used. View on Amazon
- Cryptography Engineering: Design Principles and Practical Applications by Niels Ferguson, Bruce Schneier, Tadayoshi Kohno — Hands-on engineering guidance on entropy sources, RNG design, and security pitfalls. View on Amazon
As an Amazon Associate, Roulety earns from qualifying purchases. This does not change the price you pay and helps support the writing on this site.
© 2026 Roulety. Free online spinner wheel for decisions, games, and fun.