Skip to main content

serp-random

Drop-in replacement for CPython's random module (docs/libraries.md drop-in facade push).

  • from serp_random import seed, random, randint, uniform, randrange, getrandbits, choice, shuffle
  • The generator is MT19937 (Mersenne Twister), implemented bit-for-bit like CPython: the same seeding (init_by_array over the integer's 32-bit limbs), genrand_res53 floats, and _randbelow rejection sampling. A seeded sequence is identical to CPython's random module — and therefore byte-identical across native builds and CPython runs.
  • seed() with no argument seeds from OS entropy; seed(n) is reproducible.
  • Architecture: serp_random is a pure-Serpentine facade over the compiler-known serp_random_core rtlib module (MT19937 lives in the native runtime; the CPython delegate drives the stdlib's global Mersenne Twister).
  • Divergences: getrandbits(k) caps at 63 bits (native int64); randrange/randint widths must fit in int64; error messages pinned to CPython 3.11; sample, choices, the distribution functions, and the Random class are not provided.
  • choice/shuffle work with lists of Copy elements (int/float/str/bool/bytes).

Install into a Serpentine project with serp add serp-random.

Metadata

Release files for serp-random 0.1.0

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

Source distribution (sdist)

Source distribution for serp-random 0.1.0
File Size Uploaded
serp_random-0.1.0.tar.gz 3.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for serp-random 0.1.0
File Interpreter ABI Platform
serp_random-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 7.4 kB

Release files / serp_random-0.1.0.tar.gz

Download URL serp_random-0.1.0.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
8393eb6760caf2e1583b75157741cf0ec69992dab87cc78c0a6e25d54e8b15b9
BLAKE2b-256 checksum
How to use checksums
ad13918b4233d8dc7d739770177b076df5d1007ad906040446d7f8f3ebc4a44b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.

Transparency log

Release files / serp_random-0.1.0-py3-none-any.whl

Download URL serp_random-0.1.0-py3-none-any.whl
Size 3.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6c24e7bf0e0c773607b26e70a3fa30dd1c4509e596120f16622dc9df2f9a6ca6
BLAKE2b-256 checksum
How to use checksums
39fbea52b52d91cea3adb47296d26eb4ac6bc6a4381831fb80167557ac3855fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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