Fourmilab ENT Randomness Battery

John Walker's classic Fourmilab ENT randomness evaluation suite. Computes Shannon entropy, Chi-Square distribution, arithmetic mean, Monte Carlo Pi estimation, and serial correlation.

Zero-Allocation Client-Side Engine: John Walker’s venerable ENT algorithms implemented in high-performance WebAssembly. Zero server uploads.

Classic ENT Statistical Measures

The Fourmilab ENT battery is one of the most widely adopted diagnostic suites for evaluating pseudo-random and hardware random sequences:

MetricIdeal Random ValueNormal Acceptance Range ($\alpha=0.05$)Description
Shannon Entropy$8.000000$ bits/byte$\ge 7.900000$ bits/byteInformation density: $-\sum_{i=0}^{255} p_i \log_2(p_i)$
Chi-Square ($\chi^2$)$255.00$ ($p=50\%$)$218.42 \le \chi^2 \le 293.25$ ($1\% < p < 99\%$)Frequency distribution goodness-of-fit for 256 byte values
Arithmetic Mean$127.5000$$127.5 \pm 1.0$ (sample size dependent)Average value of all bytes in the sequence
Monte Carlo $\pi$$3.14159265...$Error $< 1.0\%$Circle quadrant hit ratio using 24-bit coordinate pairs
Serial Correlation$0.000000$$\|r\| < 0.010000$Lag-1 byte-to-byte linear dependence coefficient
Compression Ratio$0.00\%$$\le 1.0\%$Percentage reduction achievable via ideal lossless compression

Probability of Exceeding $\chi^2$ ($p\text{-value}$)

  • $p > 99\%$ or $p < 1\%$: The sequence is almost certainly not random (either heavily biased or artificially uniform).
  • $95\% < p \le 99\%$ or $1\% \le p < 5\%$: The sequence is suspect.
  • $10\% \le p \le 90\%$: The sequence is statistically random.

Industry & Scientific Applications

  1. Entropy Pool Validation in Linux/BSD Kernels: Verifying that seed material gathered from /dev/urandom and kernel interrupt timings matches theoretical entropy expectations.
  2. Encrypted Ciphertext Verification: Verifying that encrypted disk volumes, TLS packet payloads, and VPN streams resemble pure white noise without recognizable header leakage.
  3. Lossless Compression Pre-filtering: Estimating the compressibility of bulk data arrays prior to invoking CPU-expensive compression algorithms (e.g. Zstandard, LZMA).
  4. Physical RNG Sensor Calibration: Validating hardware noise generators (avalanche noise diodes, thermal Johnson noise, quantum optical splitters) during manufacturing QA.