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. This idea 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.

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 kernel's interrupt handling, the bit flips are dependent on the stress of the system, which is chaotic and unpredictable. Finally, the bits are debiased using Peres's randomness extractor to ensure uniformity, which is an iterative and more efficient improvement of John von Neumann's randomness extractor.

This page is entirely self-contained and does not require any external resources. Download this page to your computer, and run it offline. It's designed to behave similarly to the live streams feature provided by the Australian National University QRNG. Due to the 1 millisecond timer however, it is slower than most modern RNGs.