A true random number generator using system sensor noise
Project description
NonPseudoRandom
NonPseudoRandom is a Python package that generates true random numbers using sensor noise from your local system. It serves as a drop-in replacement for Python's native random
module.
Supported Sensors
NonPseudoRandom utilizes various types of system sensors to generate randomness. The supported sensor types are as follows:
Sensor Type | Description |
---|---|
CPU Temperature | Measures the temperature of the CPU using psutil . |
Microphone Noise | Captures ambient noise from the microphone using sounddevice . |
Webcam Noise | Captures visual noise from the webcam using opencv-python . |
Installation
You can install NonPseudoRandom via pip:
pip install nonpseudorandom
Usage
NonPseudoRandom can be used as a drop-in replacement for Python's built-in random
module. Here are some examples:
Example 1: Generating a Random Float
import nonpseudorandom as random
print(random.random()) # Generate a random float in [0.0, 1.0)
Example 2: Generating a Random Integer
import nonpseudorandom as random
print(random.randint(1, 10)) # Generate a random integer between 1 and 10
Example 3: Choosing a Random Element from a List
import nonpseudorandom as random
print(random.choice(['a', 'b', 'c'])) # Randomly select an element from a list
Example 4: Shuffling a List
import nonpseudorandom as random
my_list = [1, 2, 3, 4, 5]
random.shuffle(my_list)
print(my_list) # The list will be shuffled
Example 5: Sampling from a Population
import nonpseudorandom as random
population = [1, 2, 3, 4, 5]
sample = random.sample(population, 3)
print(sample) # Randomly sample 3 unique elements from the population
Example 6: Generating a Random Float in a Range
import nonpseudorandom as random
print(random.uniform(1.0, 10.0)) # Generate a random float between 1.0 and 10.0
License
This project is licensed under the MIT License.
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 nonpseudorandom-0.1.1.tar.gz
.
File metadata
- Download URL: nonpseudorandom-0.1.1.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ef77f788a28275b0fc1c9f3c607f93e704e1a179be95b678da9e5fe962b5ce8 |
|
MD5 | cfcd41306d3ffdec68dd2059a0106b4b |
|
BLAKE2b-256 | be50be56ad91a0f46d7c2a05238f9fb3964f361ffe77025fbf868ab19d162c4b |
File details
Details for the file nonpseudorandom-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: nonpseudorandom-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d05d57115177945c3dbc0078ef15e8f42a798ca1a17d2b95cfae53c81eb8b263 |
|
MD5 | 76d6e995f269e4fdeb8d0a39f1967659 |
|
BLAKE2b-256 | 971701894744182fd7818cab27d42af318d0a46067949f2b174714f6473f4a2f |