real-random
real-random is a Python package that generates random values using real-world entropy from ambient microphone audio. It converts raw audio noise into cryptographic hashes, which are then transformed into useful random outputs such as:
- Floating-point numbers in [0, 1)
- Integers within a range
- Random selections from sequences
- Random alphanumeric strings
This provides a non-deterministic alternative to traditional pseudorandom generators.
Installation
pip install real-random
If you plan to build from source:
git clone https://github.com/croketillo/real-random
cd real-random
pip install .
Usage
from real_random import (
real_random,
real_random_int,
real_random_float,
real_random_choice,
real_random_string,
)
print(real_random()) # → 0.72623...
print(real_random_int(1, 10)) # → 7
print(real_random_float(0.5, 2.5)) # → 1.934...
print(real_random_choice(["red", "blue"])) # → "blue"
print(real_random_string(8)) # → "aG9xB2dZ"
How It Works
Captures 1–2 seconds of microphone input (ambient noise).
Normalizes and hashes the audio using SHA-256.
Converts part of the hash into usable randomness.
Uses that base randomness to build higher-level utilities.
If no audio signal is detected (silence), it falls back to generated synthetic noise to ensure entropy.
Requirements
A working microphone or audio input device
Python 3.7+
sounddevice, numpy
On Linux, make sure your user has access to audio input devices (PulseAudio or PipeWire is recommended).
License
This project is licensed under the MIT License.
Metadata
Release files for real-random 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| real_random-0.1.1.tar.gz | 3.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| real_random-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.2 kB
Release files / real_random-0.1.1.tar.gz
| Download URL | real_random-0.1.1.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3634011f77f806cdef3eb4b129cf7169f0834224ebc56f28563f896fd71ea94d
|
|
BLAKE2b-256 checksum How to use checksums |
2f9275aaf0a5af2d2b60b46675a182e32aa0f125fb048f0ed3afdea670f76664
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|
Release files / real_random-0.1.1-py3-none-any.whl
| Download URL | real_random-0.1.1-py3-none-any.whl |
|---|---|
| Size | 3.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
68c395b251cd596d57cc204c6c66a816bad1ae88f59bd56cf035e8746d533c41
|
|
BLAKE2b-256 checksum How to use checksums |
48fbf8ae4ac4e9b6d01116c45bdfa06ccc906b16e4714291640ea1737866f84e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|