NumPy implementation of the RGE-256 ARX-based pseudorandom number generator.
Project description
Numpyrge256
A pure NumPy implementation of RGE-256, a 256-bit ARX-based pseudorandom number generator featuring geometric rotation scheduling and structured entropy from Recursive Division Tree (RDT) analysis.
This package provides a lightweight, dependency-free core suitable for research, simulations, Monte Carlo methods, and general-purpose randomness in scientific computing.
Author: Steven Reid ORCID: 0009-0003-9132-3410 Paper: RGE-256: A New ARX-Based Pseudorandom Number Generator With Structured Entropy and Empirical Validation (Nov 2025) Zenodo: https://zenodo.org/records/17713219 PyTorch version: https://github.com/RRG314/torchrge256 Demo: https://github.com/RRG314/RGE-256-app
Key Features
- Pure NumPy implementation (no external dependencies)
- 256-bit internal state (8 × 32-bit words)
- Deterministic ARX update structure
- Rotation constants derived from structured geometric entropy
- Domain separation for independent streams
- Reproducible sequences for research and simulation
- Batch generation for large datasets
This implementation is focused on simplicity, portability, and reliability for scientific use cases.
Installation
PyPI:
pip install rge256
Or install directly from GitHub:
pip install git+https://github.com/RRG314/numpyrge256
Quick Start
from rge256 import RGE256
rng = RGE256(seed=12345)
# Single 32-bit integer
x = rng.next32()
# Float in [0, 1)
f = rng.nextFloat()
# Integer in range [lo, hi]
v = rng.nextRange(1, 100)
# Batch of numbers
batch = rng.next32_batch(1000)
API Summary
RGE256(seed, rounds=3, zetas=(1.585, 1.926, 1.262), domain="numpy")
Creates a new RGE-256 generator.
Core methods:
next32()– returns a 32-bit unsigned integernextFloat()– returns a float in [0, 1)nextRange(lo, hi)– returns an integer in [lo, hi]next32_batch(n)– generates an array of n random uint32 values
All outputs are deterministic given (seed, domain, rounds, zetas).
Notes on Statistical Behavior
Empirical testing (Dieharder, bit balance analysis, chi-square evaluation) shows:
- Entropy ≈ 7.999–8.000 bits/byte
- Uniform bit distribution (~50% ones per bit position)
- Low serial and lag-1 correlation
- Stable behavior across NumPy and PyTorch implementations
The design inherits rotation structure from geometric entropy constants used in the corresponding RDT entropy framework.
Disclaimer
RGE-256 is not designed as or intended to serve as a cryptographic random number generator. It has not been formally analyzed for cryptographic security.
Use only for research, simulation, and non-security-critical applications.
Citation
Please cite the corresponding preprint:
@misc{reid2025rge256,
author = {Reid, Steven},
title = {RGE-256: A New ARX-Based Pseudorandom Number Generator
With Structured Entropy and Empirical Validation},
year = {2025},
howpublished = {\url{https://zenodo.org/records/17713219}},
note = {ORCID: 0009-0003-9132-3410}
}
Related Repositories
-
PyTorch implementation: https://github.com/RRG314/torchrge256
-
Web-based demonstration: https://github.com/RRG314/RGE-256-app
License
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 numpyrge256-1.0.0.tar.gz.
File metadata
- Download URL: numpyrge256-1.0.0.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c02d0ec3f865324f7bff346cd0ccc19067f8667f246862bd556d8edbb68021c4
|
|
| MD5 |
a723797bdffd109b481c194c0b223d47
|
|
| BLAKE2b-256 |
56234aa193a9063a9cdcb4993f6fc309859889514e3012a6b687b2ae69fdd5ab
|
File details
Details for the file numpyrge256-1.0.0-py3-none-any.whl.
File metadata
- Download URL: numpyrge256-1.0.0-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
451ca0657b765c92f39e2eb157b9a04ab986625278909b703dd6ff1f538232d4
|
|
| MD5 |
1c6fd938018c7d1c11205ebdd630146a
|
|
| BLAKE2b-256 |
29540a23fbd89411f11f2f7db853ddbcbb8a996380cba2540bd6758a779824f5
|