A True Random Number Generator for python.
Project description
Randomless
A python module which provides a True Random Number Generator (TRNG) based on the electronic noise captured by your webcam. The api is mostly compatible with Python's default random module.
Requirements
Python 3
opencv-python==4.4.0
numpy==1.19.1
Installation
Install requirements by executing the following command.
pip install -r requirements.txt
Place the folder containing file "__init__.py" into your project directory or into the default python module installation directory.
Usage
Import.
from randomless import Random
Create a Random class instance.
random = Random()
Generate a random number just like you would with Python's default random module.
random.random()
Use any other random method the same way as it is with Python's RNG.
print('randrange:', random.randrange(0, 5, 1))
print('randint:', random.randint(0, 5))
print('choice:', random.choice([1, 2, 3, 4, 5]))
l = [1, 2, 3, 4, 5]
random.shuffle(l)
print('shuffle:', l)
print('sample:', random.sample([1, 2, 3, 4, 5], 3))
print('random:', random.random())
print('uniform:', random.uniform(0, 5))
print('triangular:', random.triangular(0, 1, 0.5))
print('betavariate:', random.betavariate(1, 1))
print('expovariate:', random.expovariate(5))
print('gammavariate:', random.gammavariate(1, 1))
print('gauss:', random.gauss(1, 1))
print('lognormvariate:', random.lognormvariate(1, 1))
print('normalvariate:', random.normalvariate(1, 1))
print('vonmisesvariate:', random.vonmisesvariate(1, 1))
print('paretovariate:', random.paretovariate(1))
print('weibullvariate:', random.weibullvariate(1, 1))
Stop the process of collecting noise from your webcam.
random.release()
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
Hashes for randomless-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 834db16a7a1519756ea02a3813c81f29f424dbe882216916977e3b7199aa2aee |
|
MD5 | 222cf6971e957aeb1aa2ad7f32f3784e |
|
BLAKE2b-256 | 01ff60d6774b4f6620bc6b3da5a5767de6534b56801172f938fcee8baf625373 |