Skip to main content

RGE-256: A pure Python 256-bit ARX pseudorandom number generator.

Project description

RGE-256 Core (v1.0.3)

A pure Python 256-bit Add–Rotate–Xor (ARX) pseudorandom number generator.

Author: Steven Reid ORCID: 0009-0003-9132-3410 License: Apache 2.0 Repository: https://github.com/RRG314/RGE-256-app Preprint: https://zenodo.org/records/17713219


⚠️ Security Notice

RGE-256 Core is not a cryptographically secure random number generator.

It MUST NOT be used for:

  • encryption
  • authentication
  • secure key generation
  • tokens
  • gambling systems
  • lotteries
  • blockchain consensus

It IS safe for:

  • simulation
  • Monte Carlo methods
  • research
  • teaching
  • non-security randomness

Overview

RGE-256 Core is a simple, deterministic PRNG implemented in pure Python. It uses:

  • a 256-bit internal state (8 × 32-bit words)
  • Add–Rotate–XOR (ARX) mixing
  • domain separation via string labels
  • fixed-round mixing (default: 3 rounds)
  • deterministic output using a 64-bit seed

This package contains only the core PRNG. No visualization, no statistical diagnostics, and no UI components are included.


Installation

pip install rge256_core

Basic Usage

from rge256_core import RGE256

rng = RGE256(seed=12345)

# 32-bit unsigned integer
x = rng.next_u32()

# float in [0, 1)
y = rng.next_float()

# integer in range
z = rng.randint(0, 100)

# N random bytes
b = rng.random_bytes(32)

RGE-256 Core is fully deterministic: the same seed + same domain always produces the same sequence.


Domain Separation

Domain labels create independent sequences even with the same seed:

rng_a = RGE256(seed=999, domain='physics')
rng_b = RGE256(seed=999, domain='graphics')

These produce completely different output streams.


Example: Monte Carlo π

from rge256_core import RGE256
import math

rng = RGE256(seed=42)

inside = 0
N = 100000

for _ in range(N):
    x = rng.next_float() * 2 - 1
    y = rng.next_float() * 2 - 1
    if x*x + y*y <= 1:
        inside += 1

pi_estimate = 4 * inside / N
print(pi_estimate)

Project Structure

The pip package includes only the core PRNG module:

  • rge256_core/rge256_core.py — core PRNG implementation
  • __init__.py — module export
  • README.md
  • LICENSE
  • pyproject.toml

No web demo features are included in the pip package.


Citation

Reid, Steven. “RGE-256: A 256-bit ARX Pseudorandom Number Generator.” Zenodo (2025). https://zenodo.org/records/17713219


License

Apache License 2.0

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

rge256_core-1.0.4.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

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

rge256_core-1.0.4-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file rge256_core-1.0.4.tar.gz.

File metadata

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

File hashes

Hashes for rge256_core-1.0.4.tar.gz
Algorithm Hash digest
SHA256 100f38c58d5a61f104318cc07be9f8ae36928d04efb1ea6112a6ae92853710b6
MD5 cebb5ce2fa320a50df6cb07b90da179b
BLAKE2b-256 a3a7412b116c574369d182a875a01dc061a88139ed36165b679385ca72dde107

See more details on using hashes here.

File details

Details for the file rge256_core-1.0.4-py3-none-any.whl.

File metadata

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

File hashes

Hashes for rge256_core-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f4f4b6a99c36d29f844a7ec3e6c45f75722d945dc76bdbe420a7ce3e3f37344a
MD5 9a7c30320d69c946561a04799bc7e51f
BLAKE2b-256 155c519ffd1369fc971c005b64ab80fedfc32fd41de96975e1861fa058ccaa60

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