JavaScript TRNG

This is a true random number generator in pure JavaScript. No, this is not a joke. It models coin flips by pitting a slow clock (the RTC) against a fast clock (the CPU). The RTC models the coin's flight in the air and the CPU models the spin of the coin.

A timer is set 1 millisecond into the future and a bit is flipped as fast as possible before the timer expires. Due to the operating system's kernel interrupt handling, the bit flips are dependent on the stress of the system, which is chaotic and unpredictable. Finally, two successive bits are debiased using John von Neumann's randomness extractor to ensure uniformity.

This was first investigated by cryptographer Matt Blaze 1995 then later by security researcher Dan Kaminsky in 2012. It was also included in Applied Cryptography by Bruce Schneier. Due to the 1 ms timer however, it is slower than most modern RNGs. This page is designed to behave similarly to the live streams feature provided by the Australian National University QRNG.

This page is entirely self-contained and does not require any external resources. Download this page to your computer, and run it offline.