Skip to main content

sts-pylib

GitHub Workflow Status Read the Docs License PyPI Python Version

A functional Python interface to the NIST Statistical Test Suite.

Quickstart

You can install sts-pylib via pip:

$ pip install sts-pylib

This will install a package sts into your system, which contains NIST's statistical tests for randomness. A complete reference is available in the docs.

>>> import sts
>>> p_value = sts.frequency([1, 0, 1, 1, 0, 1, 0, 1, 0, 1])
	      FREQUENCY TEST
---------------------------------------------
COMPUTATIONAL INFORMATION:
(a) The nth partial sum = 2
(b) S_n/n               = 0.200000
---------------------------------------------
p_value = 0.527089
>>> print(p_value)
0.5270892568655381

Note that all the tests take the input sequence epsilon (a sample of RNG output) as an array of 0 and 1 integers.

A more thorough demonstration of sts-pylib is available on Kaggle.

Contributors

The original sts C program, alongside its corresponding SP800-22 paper, were authored by the following at NIST:

  • Andrew Rukhin
  • Juan Soto
  • James Nechvatal
  • Miles Smid
  • Elaine Barker
  • Stefan Leigh
  • Mark Levenson
  • Mark Vangel
  • David Banks,
  • Alan Heckert
  • James Dray
  • San Vo
  • Lawrence E Bassham III

Additional work to improve Windows compatibility was done by Paweł Krawczyk (@kravietz), with a bug fix by @ZZMarquis.

I (@Honno) am responsible for converting sts into a functional interface, and providing a Python wrapper on-top of it. You can check out my own randomness testing suite coinflip, where I am creating a robust and user-friendly version of NIST's sts in Python.

Release files for sts-pylib 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for sts-pylib 0.0.5
File Interpreter ABI Platform
sts_pylib-0.0.5-cp38-cp38-manylinux2010_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.12+ x86-64 Details
sts_pylib-0.0.5-cp37-cp37m-manylinux2010_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.12+ x86-64 Details
sts_pylib-0.0.5-cp36-cp36m-manylinux2010_x86_64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.12+ x86-64 Details

Total release size: 311.4 kB

Release files / sts_pylib-0.0.5-cp38-cp38-manylinux2010_x86_64.whl

Download URL sts_pylib-0.0.5-cp38-cp38-manylinux2010_x86_64.whl
Size 104.1 kB
Tags CPython 3.8 Linux glibc 2.12+ x86-64
SHA-256 checksum
How to use checksums
051567675741d98cc1e3b8f6e78cb7d5716211544e8194f5b0f1d0592d5f0a1d
BLAKE2b-256 checksum
How to use checksums
dea396c038c80f910075fa1317989f9afd2af04c0f6c2af0e27e9a13d2428b2e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.5

Release files / sts_pylib-0.0.5-cp37-cp37m-manylinux2010_x86_64.whl

Download URL sts_pylib-0.0.5-cp37-cp37m-manylinux2010_x86_64.whl
Size 103.6 kB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.12+ x86-64
SHA-256 checksum
How to use checksums
fd20f222988a3c28e398ae5c274725936dfb1f8128ff36f666758ce80b92fca0
BLAKE2b-256 checksum
How to use checksums
fd757ed166f3f8041391ce7efeb8e0015229e64f8a8cc7775f45cca9da0f973b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.5

Release files / sts_pylib-0.0.5-cp36-cp36m-manylinux2010_x86_64.whl

Download URL sts_pylib-0.0.5-cp36-cp36m-manylinux2010_x86_64.whl
Size 103.7 kB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.12+ x86-64
SHA-256 checksum
How to use checksums
0694c29f5158fc12472b841775b678891943d7d2201a024612d02e8854d01a05
BLAKE2b-256 checksum
How to use checksums
11804d6bdb8f1bf8d62c247bcc07a1d425cef09087f6dea4b30244e329e38b24
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.5

Release history Release notifications | RSS feed

This release

0.0.5 This release

3 release files

0.0.4

3 release files

0.0.3

3 release files

0.0.2

3 release files

0.0.1

3 release files

0.0.0

6 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page