TorchRGE256
A PyTorch-native implementation of the RGE-256 pseudorandom number generator.
Author: Steven Reid
ORCID: 0009-0003-9132-3410
Zenodo Preprint: https://zenodo.org/records/17713219
Repository: https://github.com/RRG314/torchrge256
Overview
TorchRGE256 is a PyTorch-native implementation of the RGE-256 pseudorandom number generator (PRNG). RGE-256 is a 256-bit ARX (Add-Rotate-XOR) generator whose rotation schedule is derived from geometric entropy constants obtained through Recursive Division Tree (RDT) analysis. The PyTorch version is designed for machine learning workflows, GPU execution, reproducible training, and deterministic data generation.
TorchRGE256 provides:
- A 256-bit internal state (8 x 32-bit words)
- Deterministic and reproducible output
- CPU and CUDA support
- Full state checkpointing
- Domain separation for independent streams
- High-level random sampling utilities (uniform, normal, randint, Bernoulli, permutation, shuffle, dropout masks, and more)
This implementation is written entirely in Python and uses only PyTorch and the Python standard library.
Scientific Background
The rotation constants in RGE-256 are derived from three geometric entropy values that emerge from Recursive Division Tree (RDT) analysis:
- zeta_1 ≈ 1.585
- zeta_2 ≈ 1.926
- zeta_3 ≈ 1.262
These constants represent stable entropy ratios observed in computational experitments with entropy.
Key Features
- PyTorch-native PRNG
- Reproducible training
- CUDA support
- Domain separation
- Deterministic ARX core
Installation
Once published: pip install torchrge256
Example
import torch from torchrge256 import TorchRGE256 rng = TorchRGE256(seed=123) x = rng.rand((3, 3))
Citation
@misc{reid2025rge256, author = {Reid, Steven}, title = {RGE-256: A New ARX-Based Pseudorandom Number Generator With Structured Entropy and Empirical Validation}, year = {2025}, doi = {10.5281/zenodo.17713219} }
License
MIT License
Release files for torchrge256 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 | |
|---|---|---|---|
| torchrge256-0.1.1.tar.gz | 6.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| torchrge256-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.6 kB
Release files / torchrge256-0.1.1.tar.gz
| Download URL | torchrge256-0.1.1.tar.gz |
|---|---|
| Size | 6.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ee41d3a5ba348e50813b1a92b90b4878232f9f063c9e89e0d22687b8eb1ae47c
|
|
BLAKE2b-256 checksum How to use checksums |
8aa8286c11e9ba1a0e0cb556642231d2bcf53be5df86e499d9fb3c28f35f7b30
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Release files / torchrge256-0.1.1-py3-none-any.whl
| Download URL | torchrge256-0.1.1-py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8dd861294bf174b54bbf9ee61888ee687cf47353da437c264fae95da401c4630
|
|
BLAKE2b-256 checksum How to use checksums |
935f86a90eeb9e070e3acba1995bb96b4ecfa220c4f9847b2081dd330ae9c5f0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|