Skip to main content

PyTorch-native implementation of the RGE-256 pseudorandom number generator

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

torchrge256-0.1.1.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

torchrge256-0.1.1-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file torchrge256-0.1.1.tar.gz.

File metadata

  • Download URL: torchrge256-0.1.1.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for torchrge256-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ee41d3a5ba348e50813b1a92b90b4878232f9f063c9e89e0d22687b8eb1ae47c
MD5 fa028953fc22c189d31adb637436aecc
BLAKE2b-256 8aa8286c11e9ba1a0e0cb556642231d2bcf53be5df86e499d9fb3c28f35f7b30

See more details on using hashes here.

File details

Details for the file torchrge256-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: torchrge256-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for torchrge256-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8dd861294bf174b54bbf9ee61888ee687cf47353da437c264fae95da401c4630
MD5 757a65397874a04444dcbf4dbe9b64b8
BLAKE2b-256 935f86a90eeb9e070e3acba1995bb96b4ecfa220c4f9847b2081dd330ae9c5f0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page