Guides › NIST STS errors

NIST STS 2.1.2: common errors and fixes

The NIST Statistical Test Suite (sts-2.1.2) is the reference implementation of SP 800-22. It is also old C code with an interactive menu, and a few problems come up again and again.

Updated October 20, 2026

Build problems

"multiple definition of …" when linking

GCC 10 and newer default to -fno-common, which rejects older C code that defines global variables in headers. If the link step fails with multiple definition errors, add -fcommon to the compiler flags in the makefile and rebuild:

# in makefile
CFLAGS = -O2 -fcommon
make clean && make

Building on macOS

On macOS gcc is usually Apple clang. If the makefile's flags are rejected, build with clang explicitly (make CC=clang) and fix warnings only if they stop the build. Running inside a Linux container (docker run -it -v "$PWD":/sts gcc bash) is often quicker than chasing compiler differences.

Every test fails, even on good data

This is nearly always an input problem, not a bad generator.

The input file guide shows how to write clean files from Python, C, Linux and microcontrollers.

Bitstreams and sequence length don't match the file

./assess 1000000 sets the length of each sequence; the menu then asks how many bitstreams to test. The file must contain at least length × bitstreams bits. A 1,000,000-byte binary file holds 8,000,000 bits, so it supports at most 8 sequences of 1,000,000 bits. Asking for more makes the run fail or test incomplete data, so the results are meaningless.

Missing result folders

Results are written under experiments/AlgorithmTesting/, one folder per test. If those folders were deleted or never unpacked, the run stops with errors about files it cannot open. Re-extract the original archive, or recreate the folder structure (the distribution ships a script for this in experiments/).

"Insufficient number of cycles"

The Random Excursions and Random Excursions Variant tests need at least 500 cycles of the ±1 random walk. With fewer, they are skipped for that sequence. That is not a failure. Even random million-bit sequences fall short fairly often (details and numbers).

Reading finalAnalysisReport.txt

See interpreting SP 800-22 p-values for how much a single failure means.

Skip the build. Upload a file and run all 15 SP 800-22 tests in your browser, free, with every p-value on screen.

Run the free test

NISTTEST.COM is an independent implementation of NIST SP 800-22 Rev. 1a and is not affiliated with or endorsed by the National Institute of Standards and Technology.