Randalyze - Random Number Generator And Analyzer
What Does Randalyze Do?
Randalyze is a Python module that you can import or use directly from the command line to generate a set of random numbers. These numbers will fit a specified distribution, rather than just being evenly distributed.
It also allows you to analyze a set of numbers, to see which distribution they match.
At the moment, the only distribution that Randalyze handles is Benford's Law. It's a counter-intuitive distribution that numbers from the real world tend to follow. So, if you want to see whether invoice totals, numbers of incidents, traffic counts, etc. are realistic, analyze them using Randalyze. Checking against Benford's Law is good enough for auditors, so there's definitely something to it!
Installation
Randalyze supports Python 3.8 and later, so you can install it on Windows 7 if you want. It doesn't support Python 2.7.
To install Randalyze, create a virtual environment and use pip:
pip install randalyze
Usage
Command Line Usage
Generating Random Numbers
The generate command creates a number of random numbers. The type of generator must be specified - currently the only option is benford, and the number (or count) of numbers generated is specified with the -c option.
For example, to generate 100 random numbers with a Benford distribution, the following command line can be used:
randalyze generate -c 100 benford
or, if you're not using an active virtual environment:
python -m randalyze generate -c 100 benford
For detailled parameter descriptions, use:
randalyze --help
randalyze generate --help
One parameter worth noting is -a, or --adjustments. Benford's Law applies when a quantity of individual numbers are combined, for example in a votes across a number of regions, an invoice, or a number of individuals infected with a disease on particular date. The value of the adjustments parameter corresponds with how many numbers are combined to produce the final result. The higher this value, the more closely the generated numbers are likely to correspond to Benford's Law, but the longer it will take to generate the numbers. A lower number of adjustments will produce faster results, but they may not adhere as closely to Benford's Law.
Analyzing Numbers
If you have a set of numbers, randalyze can analyze them and tell you how close to a Benford distribution they are. These numbers may have been generated by randalyze, or maybe obtained from somewhere else - it really doesn't matter.
So, to analyze an output of 10,000 numbers from the randalyze generate command, and see whether it matches a Benford distribution to within 10%, use:
randalyze generate benford -c 10000 | randalyze analyze -t 10 benford
And to ensure the numbers in a text file numbers.txt, with one number per line, fit a Benford distribution:
cat numbers.txt | randalyze analyze -t 10 benford
or use the FILE parameter:
randalyze analyze -t 10 benford numbers.txt
And to produce the output in JSON format:
randalyze analyze -t 10 --format json benford numbers.txt
Self Testing
You can use randalyze to analyze the numbers it creates by piping the output of the generate command into the analyze command. For example, to check whether 10,000 generated numbers are wihin 10% of a Benford distribution, use:
randalyze generate benford -c 10000 | randalyze analyze -t 10 benford
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file randalyze-0.1.4.tar.gz.
File metadata
- Download URL: randalyze-0.1.4.tar.gz
- Upload date:
- Size: 15.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
poetry/1.1.13 CPython/3.9.7 Linux/5.13.0-30-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c207256b14138ca01ab6f4fdd78e758fd252c37fbc1f68c3094e9bd7f89fb9c3
|
|
| MD5 |
3f05871c3b12195ae6521bfe9f7ce706
|
|
| BLAKE2b-256 |
dc5cb023c83735418ebbf02249b356b66a06b996671e75bebe9c374c929fb3dc
|
File details
Details for the file randalyze-0.1.4-py3-none-any.whl.
File metadata
- Download URL: randalyze-0.1.4-py3-none-any.whl
- Upload date:
- Size: 11.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
poetry/1.1.13 CPython/3.9.7 Linux/5.13.0-30-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7cc7a87bcf9893186123cdcba82265f05ea2242bf9f42c4127f58b660a0f70af
|
|
| MD5 |
daf9d06aa9895bcbab298d08ad5d908f
|
|
| BLAKE2b-256 |
5493da7b6f5d548d8c8627ae98b94298314daebc102d3c5444da3fb5d16abb00
|