Skip to main content

A True Random Number Generator for python.

Project description

Downloads

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
numpy
A webcam with drivers installed.

Installation

pip install randomless

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


Download files

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

Source Distribution

randomless-0.1.8.tar.gz (3.4 kB view hashes)

Uploaded Source

Built Distribution

randomless-0.1.8-py3-none-any.whl (17.6 kB view hashes)

Uploaded Python 3

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