Entropy & Random / Random Generation
What you will do: Generate random bytes from Web Crypto, OpenSSL WASM, Math.random() and a linear congruential generator, and run the same statistical tests on each.
Worked example: Generate from the LCG source, then predict its next output from its internal state after generation — the prediction matches even though the LCG usually lands within range on the visual checks.
Runtime and privacy: The cryptographic exercise runs in this browser. Review the site privacy terms before entering sensitive material; use synthetic inputs for learning and evaluation.
Browse all Crypto Lab tools · Learn with Entropy & Randomness
For your role
- Developer / Engineer
- Generate from Web Crypto API and from Math.random() side by side: the first is the call your code should make for keys and nonces, the second is the one that must never be, and the panels show why.
- Security Architect
- The Production Entropy Sources section lists entropy-source products and, where one exists, the CMVP Entropy Validation Certificate that covers them (listed versions only); checking that evidence is where a key-generation design has to start.
- Researcher / Academic
- Generate 64 bytes from each source, Web Crypto API, OpenSSL WASM, Math.random() and Timestamp LCG, and compare them: the LCG output can be predicted from earlier bytes, yet it usually lands within range on the visual checks — a failure no output check shows.
- Certification & Validation Engineer
- The Production Entropy Sources section lists entropy-source products with the CMVP Entropy Validation Certificate that covers them, where one exists — read the version on the certificate before assuming it covers the part in your module.
- IT Ops / DevOps
- Use the four sources to see what a weak generator produces; the Production Entropy Sources list names the hardware and cloud entropy feeds to check for on your key-generating hosts.
Random Byte Generation
Compare cryptographically secure and insecure random sources side by side, and see why output that looks random can still be fully predictable.
Which 128-byte sample will look less random?
Commit to a prediction before generating. You will test whether appearance reveals predictability.
Insecure sources included for educational comparison only
Web Crypto API
The browser returns these bytes from crypto.getRandomValues().
Timestamp LCG
Linear Congruential Generator seeded from Date.now()
Production Entropy Sources
Products marketed as entropy sources for DRBGs and HSMs. Where a CMVP Entropy Validation Certificate exists it is named (checked 2026-09-24); a certificate covers the listed versions only, and none of this is demonstrated by this workshop.
Secure sources (Web Crypto, OpenSSL) draw from the operating system's entropy pool (e.g., /dev/urandom). Insecure sources (Math.random, LCG) use deterministic algorithms with predictable seeds — their output looks random but is fully reproducible. An SP 800-90A DRBG is deterministic too: its output is only as unpredictable as its seed, which SP 800-90C expects to come from validated SP 800-90B entropy sources.
Next in sequence
Entropy Testing
Run the visual checks and the SP 800-90B health tests on a sample as separate groups, and see what neither group can tell you.
Production Tool Capabilities & Verification Requirements
What this sample check establishes: Demonstrates raw noise sampling, conditioning, and pseudorandom bit sequence generation for cryptographic seeding.
Browser sandbox limitation (non-certification boundary): Browser `crypto.getRandomValues` / simulated noise sources do not expose physical ring-oscillator or avalanche-diode hardware telemetry.
What to require and test in your production tools:
- NIST SP 800-90B ESV-validated physical entropy sources feeding SP 800-90A `CTR_DRBG` / `Hash_DRBG` with a security strength at least that of the target parameter set (FIPS 203 §3.3: 128, 192 or 256 bits; use 256 for ML-KEM-1024 and CNSA 2.0 profiles).
- Continuous hardware health testing (Repetition Count Test and Adaptive Proportion Test) with instant fail-closed behavior.
- Verified OS / hypervisor entropy forwarding (`virtio-rng` / CPU `RDSEED`) into containerized workloads.
Try it
- 1. Predict before you run it.
- 2. Run or change the tool above.
- 3. Explain what the result shows.
Generate 64 bytes from Timestamp LCG. Why can the next output be predicted?
Next step
Keep learning: PQC 101PQC 101 follows Entropy & Randomness, the module this tool practises, in the Foundations track.
Related content
Next in Entropy & Random