Quick Answer: Computers generate random numbers using mathematical algorithms. Standard algorithms (PRNG) produce sequences that appear random but are mathematically predictable. Cryptographic algorithms (CSPRNG) collect real-world entropy (system noise, hardware events) making their output computationally impossible to predict.
Why Computer Randomness Is Different From Physical Randomness
A computer is a deterministic machine — given the same input, it produces the same output every time. True randomness requires unpredictability, which is fundamentally at odds with determinism. Computers achieve "randomness" either by using mathematical algorithms that produce unpredictable-looking sequences, or by measuring genuinely unpredictable physical phenomena.
Pseudo-Random Number Generators (PRNG)
A PRNG uses a mathematical formula seeded with an initial value (the "seed") to produce a sequence of numbers. The same seed always produces the same sequence. JavaScript's Math.random() is a PRNG — fast, sufficient for games and simulations, but predictable if the seed is known. Popular PRNG algorithms include Mersenne Twister and Xorshift.
Cryptographically Secure PRNGs (CSPRNG)
A CSPRNG adds an extra requirement: even if you know many output values, you cannot predict future values or determine the seed. This is achieved by:
- Collecting entropy from unpredictable hardware events (keystrokes, mouse movements, network timing, CPU temperature fluctuations)
- Mixing this entropy into the generator's state continuously
- Using one-way mathematical functions that cannot be reversed to reveal the internal state
The Web Crypto API
Modern browsers implement the Web Crypto API — specifically window.crypto.getRandomValues() — as their CSPRNG interface. This is the same API used for generating TLS/SSL encryption keys. PickRandom.online uses this API exclusively, giving every coin flip, dice roll, and number generation bank-grade cryptographic randomness.
| Type | Example | Predictable? | Use Case |
|---|---|---|---|
| PRNG | Math.random() | Yes, if seed known | Games, simulations, non-security use |
| CSPRNG | Web Crypto API | No — computationally impossible | Encryption, security, fair random tools |
| Hardware RNG | Atmospheric noise | No — physically random | Seed sources for CSPRNGs |