Skip to main content

Chaos-based random number generator using three-body dynamics

Project description

Chaos RNG

CI Python 3.9+ License: MIT

Chaos RNG is a Python library for generating random numbers from chaotic three-body dynamics, with NumPy-compatible generators and optional cryptographic post-processing utilities.

This project is currently documented README-first for the 0.1.x releases.

Installation

Core package:

pip install chaos-rng

With optional crypto and test utilities:

pip install "chaos-rng[crypto,test]"

Quick Start

from chaos_rng import ThreeBodyRNG

rng = ThreeBodyRNG(seed=42)

print(rng.random(5))            # floats in [0, 1)
print(rng.randint(0, 10, 5))    # integers
print(rng.bytes(16).hex())      # raw bytes

Notes:

  • First calls may be slower because numerical kernels warm up (Numba/JIT).
  • Use a fixed seed for reproducible tests and experiments.

NumPy Integration

from chaos_rng.generators import create_chaos_generator

gen = create_chaos_generator(seed=42)

normal = gen.normal(size=1000)
uniform = gen.uniform(0, 10, size=100)
integers = gen.integers(0, 100, size=50)

Optional Crypto Utilities

The crypto extra provides helper utilities for secure seeding and post-processing. These tools are useful for experimentation and integration, but this project should not be treated as a drop-in replacement for a security-audited cryptographic RNG.

from chaos_rng import ThreeBodyRNG
from chaos_rng.security import CryptoPostProcessor, SecureSeed

seed = SecureSeed().generate_seed()
rng = ThreeBodyRNG(seed=seed)

raw = rng.bytes(64)
processed = CryptoPostProcessor(method="hash").process(raw)

print(len(processed))

Validation Utilities (Optional / Expensive)

Validation helpers are included under chaos_rng.utils.validation. They can be computationally expensive and are best used for offline analysis.

from chaos_rng import ThreeBodyRNG
from chaos_rng.utils.validation import EntropyValidator

rng = ThreeBodyRNG(seed=42)
bits = (rng.random(10000) * 2).astype(int)

validator = EntropyValidator()
result = validator.validate_entropy_rate(bits)
print(result)

NISTTestSuite and ContinuousValidator are also available, but they are not part of the default CI gate in 0.1.1.

Performance and Caveats

  • This library prioritizes clarity and reproducibility over minimal dependency footprint (numpy, scipy, numba).
  • Some operations are expensive for large sample sizes.
  • Cryptographic helpers are optional and not a substitute for audited crypto libraries or formal security review.

Development

Common commands:

make install-dev
make lint
make test
make test-slow
make build
make check-build

Local release gate:

make release-check

Release Flow (0.1.x)

The intended release path is:

  1. Tag release (v0.1.1)
  2. Publish to TestPyPI
  3. Smoke-test install from TestPyPI
  4. Publish to PyPI

GitHub Actions workflows:

  • CI (.github/workflows/ci.yml)
  • Release (.github/workflows/release.yml)

License

MIT License. See 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

chaos_rng-0.1.1.tar.gz (39.1 kB view details)

Uploaded Source

Built Distribution

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

chaos_rng-0.1.1-py3-none-any.whl (37.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: chaos_rng-0.1.1.tar.gz
  • Upload date:
  • Size: 39.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for chaos_rng-0.1.1.tar.gz
Algorithm Hash digest
SHA256 873f415c025e056faa12b3a3877d4208e652f96cc460d454bfa50c66097a28ae
MD5 caab259e13ad5a545c8ea4a486f2ccbf
BLAKE2b-256 e14a1f5eb66735bdb83cebbdab90ad30b3cac455f14c51a5b80a421a53df4b96

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chaos_rng-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 37.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for chaos_rng-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ee4634360e67a40d9dbec7d2bc26f7e0da67ee63790ef01344f522fbe291c541
MD5 cf54b87ecb5288b931326621bbf9ceba
BLAKE2b-256 a526ce08d1aeef03ceae2b0a67a28f8039040a040dfe4293fc857451fc706a93

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