Absolute Random Disorder (AND) is a Pseudo Random Number Generator which can be used to generate random numbers.
If you are interested in knowing how I built AND and how it works, then do check out the paper that I wrote: How AND works?
Note: I built AND just as a hobby project and it is not meant to be used for any serious random number generation.
You need to install the following on your machine.
1. Downloading the repository:
Start by cloning the repository with git clone https://github.com/Light-Lens/AND-PRNG.git
.
$ cd AND-PRNG
2. Usage:
- Basic usage.
from AND import AND
rng = AND()
print(rng.random())
print(rng.random())
# output (will be different as seed is chosen randomly):
# 0.3650166848587213
# 0.5590273227069147
- Setting a custom seed
from AND import AND
# state (float, optional): Initial value for the generator (default is 0.1). Must be between 0 and 1.
# seed (float, optional): Parameter for the generator; if negative, it's seeded randomly using system entropy (default is -1). Must be between 0 and 1.
rng = AND(state=0.234, seed=0.213423)
print(rng.random())
print(rng.random())
# output:
# 0.4370307820583853
# 0.29148105360873006
- Changing the state and seed after initialization
from AND import AND
rng = AND()
print(rng.random())
print(rng.random())
# output:
# 0.15080696090111667
# 0.2349507251470147
# You must set both, rng.state and rng.seed to get consistent results.
rng.state = 0.234
rng.seed = 0.213423
print(rng.random())
print(rng.random())
# output:
# 0.4370307820583853
# 0.29148105360873006
All code is licensed under an MIT license. This allows you to re-use the code freely, remixed in both commercial and non-commercial projects. The only requirement is to include the same license when distributing.