https://github.com/honno/sts-pylib
Python interface to the NIST statistical tests for randomness
https://github.com/honno/sts-pylib
nist randomness rng sts
Last synced: 6 months ago
JSON representation
Python interface to the NIST statistical tests for randomness
- Host: GitHub
- URL: https://github.com/honno/sts-pylib
- Owner: honno
- License: other
- Created: 2020-08-20T10:41:07.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2022-04-21T21:20:38.000Z (over 3 years ago)
- Last Synced: 2025-04-09T09:17:34.425Z (6 months ago)
- Topics: nist, randomness, rng, sts
- Language: C
- Homepage: https://sts-pylib.readthedocs.io
- Size: 3.6 MB
- Stars: 4
- Watchers: 3
- Forks: 2
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# sts-pylib




A functional Python interface to the NIST Statistical Test Suite.
## Quickstart
You can install `sts-pylib` via `pip`:
```console
$ 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](https://sts-pylib.readthedocs.io/en/latest/).```pycon
>>> 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](https://www.kaggle.com/justhonno/overly-simplistic-randomness-testing-demo).## Contributors
The [original sts C program](https://csrc.nist.gov/Projects/Random-Bit-Generation/Documentation-and-Software),
alongside its corresponding [SP800-22 paper](https://csrc.nist.gov/publications/detail/sp/800-22/rev-1a/final),
were authored by the following at [NIST](https://www.nist.gov/):* 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 IIIAdditional work to improve Windows compatibility was done by
Paweł Krawczyk ([@kravietz](https://github.com/kravietz)),
with a bug fix by [@ZZMarquis](https://github.com/ZZMarquis).I ([@Honno](https://github.com/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](https://github.com/Honno/coinflip/),
where I am creating a robust and user-friendly
version of NIST's sts in Python.