True vs Pseudo Random Number Generation
What you'll learn: You'll understand the critical difference between true randomness from physical processes and algorithmic randomness from computation.
The Core Distinction
Randomness is the foundation of cryptographic security—used for generating keys, initialization vectors, nonces, and more. But not all randomness is created equal.
True Random Number Generators (TRNGs) harvest unpredictability from physical phenomena: radioactive decay, thermal noise in circuits, atmospheric noise, or timing variations in hardware events. These sources produce genuine, non-repeatable randomness because they capture real-world entropy.
Pseudo-Random Number Generators (PRNGs) are deterministic algorithms. Given the same starting value (called a seed), they always produce the exact same sequence of numbers. They're "pseudo" random because the output looks random and passes statistical tests, but it's entirely predictable if you know the seed.
An Analogy
Think of a TRNG as rolling a physical die—each roll is truly independent, influenced by air currents, hand motion, and countless unpredictable factors.
A PRNG is like a magician's trick die that follows a complex but fixed pattern. If you know the starting position, you can predict every "roll" that follows. The pattern might be so complex it seems random, but it's actually reproducible.
Why This Matters in Security
For cryptographic purposes, you need unpredictability that an attacker cannot reproduce. TRNGs provide this, but they're often slow. PRNGs are fast but dangerous if improperly seeded. Modern systems typically use TRNGs to seed cryptographically secure PRNGs (CSPRNGs), combining the best of both: genuine entropy at the start, fast generation afterward.
Key Takeaway: TRNGs provide true unpredictability from physical sources, while PRNGs generate deterministic sequences that only appear random—understanding this distinction is critical for secure key generation and cryptographic operations.