Skip to main content

senol-randomizer

An RNG-core-based random data generator written in a cryptographic style — but lacking any cryptographic proof — which creates an information asymmetry between the program and /dev/urandom.


logo

Python License Status GitHub PyPI


Table of Contents


Overview

senol-randomizer is a Python library that wraps /dev/urandom entropy with a modular exponentiation layer using large 256-bit prime numbers. The result is a pseudorandom stream that passes all 15 NIST SP 800-22 Rev. 1a statistical tests, while deliberately not claiming cryptographic security — the transformation adds complexity at the cost of provable properties.


Installation

pip install senol-randomizer

How It Works

  1. Entropy source: Reads 256-bit raw values from /dev/urandom.
  2. Transformation: Applies powmod(a, b, n) via the gmpy2 library — performing modular exponentiation for each value of n.
  3. Prime moduli: The set of n values consists exclusively of 256-bit prime numbers.
  4. Derived types: All higher-level data types (str, float, bool, etc.) are derived from this core output.

The design intentionally introduces an asymmetry: the consumer of the output has less information about the internal state than /dev/urandom alone would expose, but this property is structural, not mathematically proven.


API Reference

Function Description Arguments Returns
RNG() Core function. Generates a random large integer with no range constraint. — int
newint() Random integer within a given range. min_val: int, max_val: int int
newfloat() Random float within a given range. min_val: int, max_val: int float
newbool() Random boolean. — bool
newbyte() Random bytes of a given length. num: int bytes
newstr() Random string sampled from the full Unicode range. num: int, min_val: int, max_val: int str
newtoken() Random URL-safe string. length: int str
choice() Selects a random element from a list. lst: list any
shuffle() Shuffles a list in-place and returns it. O(n). lst: list list
compress() Maps a value into [min, max] while minimizing modulo bias. value, min_val: int, max_val: int int

Statistical Test Results

Results from the NIST SP 800-22 Rev. 1a test suite, run against 1 Mibibit (33,554,432 bits) of RNG() output.

Test P-Value Result
monobit_test 0.046613138703915244 ✅ PASS
frequency_within_block_test 0.6787903492122158 ✅ PASS
runs_test 0.33232036052397196 ✅ PASS
longest_run_ones_in_a_block_test 0.21020703185565603 ✅ PASS
binary_matrix_rank_test 0.2571877713800565 ✅ PASS
dft_test 0.8685773273998374 ✅ PASS
non_overlapping_template_matching_test 0.893926430778068 ✅ PASS
overlapping_template_matching_test 0.7796009868841686 ✅ PASS
maurers_universal_test 0.9802530560443485 ✅ PASS
linear_complexity_test 0.4685290247356243 ✅ PASS
serial_test 0.5630465232357214 ✅ PASS
approximate_entropy_test 0.5631130245829565 ✅ PASS
cumulative_sums_test 0.039939937090386124 ✅ PASS
random_excursion_test 0.5178616373360564 ✅ PASS
random_excursion_variant_test 0.14694060874229203 ✅ PASS

15 / 15 PASS — Work in progress.


Links

GitHub Repository · PyPI Package

Author on GitHub · Author on PyPI


— Batuhan Şenol

Metadata

Release files for senol-randomizer 0.2.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for senol-randomizer 0.2.5
File Size Uploaded Provenance
senol_randomizer-0.2.5.tar.gz 12.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for senol-randomizer 0.2.5
File Interpreter ABI Platform
senol_randomizer-0.2.5-py3-none-any.whl Python 3 none any Details

Total release size: 25.3 kB

Release files / senol_randomizer-0.2.5.tar.gz

Download URL senol_randomizer-0.2.5.tar.gz
Size 12.6 kB
Tags Source
SHA-256 checksum
How to use checksums
953da39a72641996e1260e0ece04af1642a138d9d3ff6c9d20b2090d31aa2122
BLAKE2b-256 checksum
How to use checksums
4cd2a259b45b476bf6ea943054ed5762ccac407de7a5e1ca603e7424df8f2896
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.6

Release files / senol_randomizer-0.2.5-py3-none-any.whl

Download URL senol_randomizer-0.2.5-py3-none-any.whl
Size 12.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f287c94f38094f53d17987880684be7edfb8922ee61385ab296d11ac72dfcb75
BLAKE2b-256 checksum
How to use checksums
96422b70d7267075ff7539bcdb1ca6de9bb883a2fff4d98df307a27c84eb76c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.6

Security for senol-randomizer 0.2.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.5 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page