0Pricing
Cryptology Academy · Lesson

True Randomness vs Pseudorandomness

Distinguish hardware entropy sources from software PRNGs.

True Randomness vs Pseudorandomness is a free Cryptology Academy lesson on CoddyKit — lesson 1 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Cryptology Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Why Randomness Matters

Cryptographic security depends fundamentally on unpredictability. If an attacker can predict your key, IV, or nonce — even partially — the entire cryptographic system may collapse. Weak randomness has caused catastrophic real-world breaks.

True Random Number Generators (TRNGs)

TRNGs harvest physical entropy: thermal noise in resistors, shot noise in reverse-biased diodes, radioactive decay, mouse movements, keystroke timings, disk seek latencies. These are genuinely unpredictable physical phenomena.

Entropy Pool

The OS maintains an entropy pool — a collection of physical noise samples XORed and hashed together. Linux: /dev/random and /dev/urandom draw from this pool. The pool is replenished continuously as the system runs.

Pseudorandom Number Generators (PRNGs)

A PRNG (also called a Deterministic RNG / DRNG) expands a short seed into a long stream of pseudo-random bytes using a deterministic algorithm. Given the same seed, it produces the same output. Not suitable for cryptography unless seeded with true entropy.

PRNG vs CSPRNG

A PRNG may have detectable statistical bias or be predictable from observed output. A Cryptographically Secure PRNG (CSPRNG) adds: (1) forward security (past output not predictable from current state) and (2) backtracking resistance (future output not predictable from past).

Distinguisher Test

A PRNG is cryptographically secure if no polynomial-time algorithm can distinguish its output from a truly random sequence with probability significantly better than 1/2. This is the Next-Bit Unpredictability criterion.

Entropy Sources on Different Platforms

Linux: /dev/urandom (non-blocking, after initial seeding), getrandom() syscall. Windows: CryptGenRandom(), BCryptGenRandom(). macOS/iOS: SecRandomCopyBytes(). Browser: window.crypto.getRandomValues(). All feed into the OS entropy pool.

Statistical Tests

NIST SP 800-22 provides 15 statistical tests for randomness: frequency, block frequency, runs, Maurer's universal, linear complexity, etc. Passing statistical tests does not prove cryptographic security — just absence of obvious bias.

Seed Quality

A CSPRNG seeded with weak entropy (e.g., current time in seconds) is predictable. An attacker who knows the seed reconstructs the entire output. Always seed from OS entropy: os.urandom(32) in Python, not time.time() or random.random().

Hardware RNGs

Intel RDRAND (x86 instruction) returns hardware-generated random bytes from a TRNG on-chip. AMD and ARM equivalent hardware exists. Linux mixes RDRAND into /dev/urandom. Used as supplemental entropy, not sole source (due to trust concerns).

Quantum Random Number Generators

QRNGs use quantum-mechanical phenomena (photon arrival times, vacuum fluctuations) for provably random output. Commercial QRNGs (ID Quantique, Quantis) are used in high-security applications. Cost prohibitive for general use.

Quick Check

What property distinguishes a CSPRNG from a regular PRNG?

Recap

TRNGs harvest physical entropy; PRNGs expand a seed deterministically; CSPRNGs are indistinguishable from true randomness. OS entropy pools combine both. Next: specific CSPRNG designs used in practice.

Frequently asked questions

Is the “True Randomness vs Pseudorandomness” lesson free?

Yes — the full text of “True Randomness vs Pseudorandomness” is free to read here on the web, and the Cryptology Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Cryptology Academy course, upgrade to CoddyKit PRO.

What will I learn in “True Randomness vs Pseudorandomness”?

Distinguish hardware entropy sources from software PRNGs. You practise Cryptology Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Cryptology Academy?

No prior experience is required. Cryptology Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 1 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “True Randomness vs Pseudorandomness” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Cryptology Academy lesson?

Yes. Every Cryptology Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. True Randomness vs Pseudorandomness
  2. Cryptographically Secure PRNGs
  3. Entropy Starvation & Weak-Key Bugs
  4. Generating Keys, Nonces & IVs Safely
← Back to Cryptology Academy