What is a random number generator?
A random number generator is any system that produces values an attacker cannot predict. In practice there are two broad kinds: deterministic generators that stretch a seed, and physical generators that extract unpredictability from a measurable process. Nearly every real system uses both together.
The two halves of every real generator
Production systems almost never use one generator. They use a physical source to produce a seed, and a deterministic algorithm to expand that seed into as many bits as the application needs. NIST calls the first an entropy source and the second a DRBG, a deterministic random bit generator. Both halves have to be right.
This matters because the two halves fail in opposite ways. A deterministic generator fails silently and completely: given the same seed it produces the same stream forever, and nothing about the output looks wrong. A physical source fails gradually and detectably, if you are measuring it.
The four terms, briefly
- PRNG — expands a seed by a deterministic rule. Fast, reproducible, and not safe for keys unless it is also cryptographically secure.
- CSPRNG — a PRNG built so that seeing output does not let you compute past or future output. The construction is worth understanding.
- TRNG — derives bits from a physical process such as thermal noise or jitter.
- QRNG — a TRNG whose randomness comes from a quantum process, which is what makes a physical entropy model possible rather than merely plausible.
Which one you need
If you are generating long-lived keys, you need a physical source somewhere in the chain and evidence about it. If you are producing large volumes of random data from a well-seeded CSPRNG, you may need nothing more. The honest version of this question is worth reading before you specify hardware.
What is not a real answer is "the operating system handles it". Modern kernels do a competent job of pooling entropy, but the guarantees they can offer depend entirely on what the underlying hardware gave them, and on most platforms that is not something you can inspect.
Keep reading
- Fundamentals
What is a CSPRNG, and where the DRBG fits
A CSPRNG is a deterministic algorithm that expands a seed into a long stream, built so that observing part of the output does not let an attacker compute the rest. In the NIST vocabulary the mechanism is a DRBG, and it sits downstream of an entropy source that seeds and reseeds it.
- Fundamentals
Hardware RNG or software RNG, asking the question properly
The useful question is not hardware versus software but where unpredictability physically originates and what evidence exists about it. Every practical system uses both: a physical source to seed, and a deterministic algorithm to expand. The distinction that matters is whether the physical half is characterised or merely assumed.
- Fundamentals
QRNG vs TRNG vs PRNG, the differences that matter in production
A PRNG expands a seed, a TRNG measures a physical process, and a QRNG measures a quantum one. The difference that matters in production is not speed but evidence: a quantum source can be described by a physical model, which makes its entropy estimate something you can argue about rather than assert.