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.0.tar.gz (5.7 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.0-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: torchrge256-0.1.0.tar.gz
  • Upload date:
  • Size: 5.7 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.0.tar.gz
Algorithm Hash digest
SHA256 ce36e7a2429b132d92d3830b3ad7787b854eab9cf5db54739fd93bb77e05b1fa
MD5 04a25fc7d461226ba4a3d4a6df87647d
BLAKE2b-256 6c194b40093812c5f568577f8b679f6783f0cbd46c09731ccf6d513298ac3ec0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: torchrge256-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.2 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3662fc948a53157784d1a1dcd52e5f234da3db5517ebada0246f5ef29dc9b2a3
MD5 a649bebf596ea49b220465372061a229
BLAKE2b-256 28b64a3b09634801b1510b9f2b85381edb97155654b9748058f18222fb374be9

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