Skip to main content

Quick and accurate determinations of the randomness of a sequence

Project description


A light package for quick and accurate determinations of the randomness of a sequence.


Identifying random patterns, and conversely, ordered patterns, is a major tool with applicability to a wide variety of fields, from mathematical analysis to cybersecurity. Random Test looks for randomness in sequences of numbers by searching for patterns which are inherently unpredictable. It uses an exponentially-decaying moment prediction to determine the net deviation between the predicted and actual elements of a sequence. In tests, this led to a net predictive accuracy of 99.85% for nonrandom sequences and 96.82% for random sequences. Additionally, this package is able to provide these predictions in under a millisecond for sequences shorter than 10 elements and under 100 milliseconds for sequences shorter than 1000 elements.


RandTest is built for Python 3. It has only one requirement:

- Numpy


To download randtest, use PyPI via pip:

$ pip install randtest

Alternatively, you can clone this Github repository and build from source:

$ git clone
$ cd randtest
$ python install

Verify your installation by running

>>> import randtest
>>> randtest.random_score([0, 1, 2, 3])


RandTest is extremely simple to use. You only need to input either a list or a 1D Numpy array of numbers. The prediction returns False if the sequence is ordered and True if the sequence is random.

import numpy as np
import randtest as rt

ordered_sequence = np.arange(10)
random_sequence = np.random.randint(10, size=10)





Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

randtest-0.7.tar.gz (4.8 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page