RGE-256: Geometric Entropy PRNG
A novel ARX-based pseudorandom number generator (PRNG) with rotation schedules derived from Recursive Division Tree (RDT) entropy constants.
Features
- 256-bit State: 8 × 32-bit words for large period and good distribution
- ARX Architecture: Add-Rotate-XOR operations for efficient mixing
- RDT-Derived Constants: Rotation schedule based on mathematical entropy constants
- Multiple Output Formats: 32-bit, 64-bit, floats, ranges, bytes
- State Serialization: Save and restore generator state
- Utility Functions: Shuffle, choice, sample
Installation
pip install rge256-core
Quick Start
from rge256_core import RGE256
# Create a generator with a seed
rng = RGE256(seed=12345)
# Generate random numbers
print(rng.next32()) # Random 32-bit integer
print(rng.next_float()) # Random float in [0, 1)
print(rng.next_range(1, 100)) # Random int in range [1, 100]
# Generate random bytes
random_bytes = rng.next_bytes(16)
print(random_bytes.hex())
# Shuffle a list
deck = list(range(52))
shuffled = rng.shuffle(deck)
API Reference
Constructor
RGE256(
seed=None, # int, bytes, str, or None (uses system entropy)
rounds=3, # Number of mixing rounds (1-10)
zetas=(1.585, 1.926, 1.262), # RDT entropy constants
domain="rge256-default" # Domain separation string
)
Methods
| Method | Returns | Description |
|---|---|---|
next32() |
int |
Random 32-bit unsigned integer |
next64() |
int |
Random 64-bit unsigned integer |
next_float() |
float |
Random float in [0, 1) |
next_double() |
float |
High-precision random double |
next_range(min, max) |
int |
Random integer in [min, max] |
next_bytes(n) |
bytes |
n random bytes |
shuffle(list) |
list |
Fisher-Yates shuffled copy |
choice(list) |
any |
Random element from list |
sample(list, k) |
list |
k unique random elements |
Design Notes
RGE-256 is a statistical PRNG, not a cryptographically secure RNG. Do not use for cryptographic applications.
Author
Steven Reid - ORCID: 0009-0003-9132-3410
License
MIT License
Release files for rge256-core 1.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| rge256_core-1.0.7.tar.gz | 5.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| rge256_core-1.0.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.6 kB
Release files / rge256_core-1.0.7.tar.gz
| Download URL | rge256_core-1.0.7.tar.gz |
|---|---|
| Size | 5.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1d87eb507c63ca2d2a6c72aed8900270d5c6e3fbf0a67ac4c7b1ec9a977fbc08
|
|
BLAKE2b-256 checksum How to use checksums |
812a2f5be4a2cd2d85aae24cbe3e4a6ed34c7199eefb81fac68a9c34582e0a83
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Release files / rge256_core-1.0.7-py3-none-any.whl
| Download URL | rge256_core-1.0.7-py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
155825f3150b5a8bb18964f4eaf02b0507489f260cb5af4fd9baee31a854c4af
|
|
BLAKE2b-256 checksum How to use checksums |
73c1614a13182a0a4fe0dfaeb8f07f38fb0f4b4ad22aba45cd078a8714f1d0b7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|