Pseudorandom, 100% reproducible variable generators
Project description
notrandom: Pseudorandom, 100% reproducible variable generators.
Implementation of the builtin ‘random’ API, which guarantees 100% deterministic and reproducible computation of values, regardless of python versions, operating system or environment (a guarantee that the ‘random’ module does not provide). Non randomness guaranteed!
For example, when seeding the generator with the integer 0, the those are the first 3 floating numbers, across all systems, Python Implementations and versions. Try it yourself!
>> from notrandom import random, seed >> seed(0) >> print(random(), random(), random()) 0.40003172633476936 0.16874476805609495 0.07212944838504431
This package is based on the builtin ‘random’ module and strongly resembles its API, with only minor adjustments. In particular, all global functions of random are also available in notrandom, in addition to the notrandom.Random object which implements the random.Random api. Check out the test.py file for usage examples.
It is important to note that the values computed by the notrandom are actually not random at all, as the process is 100% deterministic (that is the whole point!). Obviously, it is not intended to be used cryptographically in any way or circumstance.
Behind the scenes, notrandom uses the cryptographic hash function SHA256, in a process that resembles the OFB mode of operation. The algorithm produces blocks of 256bits ad-hoc, by hashing the previous 256bit block using SHA256, where the initial block is derived from the key directly. Then using similar technics to the ones that ‘random’ uses, random floating point numbers and integers in range are derived when requested.
Project details
Release history Release notifications | RSS feed
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
File details
Details for the file notrandom-1.0.0.tar.gz
.
File metadata
- Download URL: notrandom-1.0.0.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8fc1073c2d17a8e5b7e1f54b55a614c09678ab54d9f0f64393b0525bef2c7f0c |
|
MD5 | b2cb3531a8596a414725c3737562c851 |
|
BLAKE2b-256 | 4101c836d5267fd5dce4324d40380e2ef53dd3e5a402eb40458ac48872bac5b6 |
File details
Details for the file notrandom-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: notrandom-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | effaa4c994a5a9f94ea872375a1766a7bc286f2eb64e8866917f26bd1ec741c6 |
|
MD5 | b6c873ef392a627b449be83b8357bc05 |
|
BLAKE2b-256 | 89a362134c7290dcef7a889dd5834fb3e018b79036bf851bc83cad42a7b52010 |