Entropy-based random generator using microphone audio to produce real random floats, integers, strings, and choices.
Project description
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/yourusername/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.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file real_random-0.1.0.tar.gz.
File metadata
- Download URL: real_random-0.1.0.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
365286b2fac3d71ae802dfee0c1cdaa0a1e564c1983aa3f46a68eeda96b7a235
|
|
| MD5 |
fe0b7b47079d5afc8aa68d836d7966ef
|
|
| BLAKE2b-256 |
c1d4656b740e7e9d6d7345ccb70d544a767d06426dcb5bb3f818a01ca4debb1e
|
File details
Details for the file real_random-0.1.0-py3-none-any.whl.
File metadata
- Download URL: real_random-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c024ef0ebe6d7eacc55c3d2dae3790624a7b0f38b3bbaf57d56744529a1f2966
|
|
| MD5 |
3e25acd73fed4c587ee97efd77024df7
|
|
| BLAKE2b-256 |
be0e2e35d8f1390d620ffb50408a241b8b41bc8ab32eded8302b54cc11bffea0
|