Entropy & Random / QRNG Demo

What you will do: Compare a simulated QRNG sample, a CSPRNG sample and a deliberately broken PRNG on the same visual checks and SP 800-90B health tests, shown as separate groups.

Worked example: Run the checks on all three samples: only the weak PRNG stands out, because the simulated QRNG and the CSPRNG are the same kind of output.

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

Researcher / Academic
Generate CSPRNG and Run the Checks on All Three Samples: the visual checks and the SP 800-90B health tests for the Simulated QRNG, the CSPRNG and the Weak PRNG sit side by side in separate groups, and the page states that the Simulated QRNG sample is produced by crypto.getRandomValues, not quantum hardware.
Curious Explorer
Press Run the Checks on All Three Samples and look at which source stands out: only the weak one does. The “quantum” sample here is simulated with ordinary computer randomness, and even a real quantum device could not be told apart from a good computer generator by these checks.

Simulation — no QRNG hardware involved. The “QRNG” sample below is generated on load (and on Try Another Sample) by the browser’s crypto.getRandomValues() — the same classical CSPRNG call the “CSPRNG” panel uses. It stands in for QRNG output so you can see the data flow and the tests; nothing here comes from a quantum device.

This tool compares three samples side by side: a simulated “QRNG” sample, a fresh sample from your browser's CSPRNG (Web Crypto API), and a deliberately broken weak PRNG. The first two are the same kind of output, so any difference in their results is sampling noise. The weak PRNG should visibly fail several tests, which shows what the tests can catch.

What this demo shows

  • Simple statistical tests catch grossly broken output, like the weak PRNG's.
  • Good output from different generators looks the same to these tests.

What it does not show

  • Anything about a real QRNG — no quantum device is involved.
  • How much entropy any source has. SP 800-90B estimates entropy from at least 1,000,000 raw noise-source samples, not from 64 or 128 bytes of final output.
  • That any source is validated or certified.
Sample Size:
Simulated

Simulated QRNG

crypto.getRandomValues() stand-in
4bbaccc1 2f2a3ac0 e312a66e faed03c9 34c616e4 c8470d7e ce6c51f7 277beee7 8e3fd4c7 21c58634 2094747a 683b30f2 e3e20ed8 524b742c bb5fc3d5 d9bfc42b
00
40
80
C0

CSPRNG (OS Entropy)

Browser Web Crypto API
No data yet — click Generate CSPRNG
Broken

Weak PRNG

Math.random() & 0x0F · high nibble forced to 0
09080a02 0b030704 0c08060e 0b030009 090d0203 000b0002 020f090e 010e0f01 0b050f02 00020e08 0e0f0504 050d0a0d 0d080802 0f0e0607 0a050e05 0f0a0d09
00
40
80
C0
Production Tool Capabilities & Verification Requirements

What this sample check establishes: Illustrates quantum random number generation (shot-noise / photon arrival / phase fluctuation) conditioning and entropy mixing with classical CSPRNGs.

Browser sandbox limitation (non-certification boundary): Simulates quantum noise distributions mathematically in the browser; no physical optical QRNG hardware is attached.

What to require and test in your production tools:

  • Entropy combination per SP 800-90C (RBG3(XOR)/RBG3(RS)) and CMVP IG D.O, where each source (including a QRNG) is itself SP 800-90B validated; a local OS/HSM source is a design choice, not a requirement.
  • Authenticated, integrity-protected transport if entropy is streamed from an external appliance over a network or PCIe bus.
  • Continuous SP 800-90B health tests (Repetition Count Test, Adaptive Proportion Test) on each raw source prior to conditioning.

Try it

  1. 1. Predict before you run it.
  2. 2. Run or change the tool above.
  3. 3. Explain what the result shows.

The simulated QRNG and CSPRNG samples both pass the displayed checks. What can you infer about their sources?

Two sample random-number files look similarly balanced. Only one source has reproducible characterization and a health-test record. Which evidence supports a source-quality decision?

Next step

Keep learning: PQC 101

PQC 101 follows Entropy & Randomness, the module this tool practises, in the Foundations track.

Next in Entropy & Random