seedrandom
Deterministic seeded RNG
Installation / Updating
pip install seedrandom
pip install --upgrade seedrandom
Or
pip install git+https://github.com/BananaLoaf/seedrandom.git
pip install --upgrade git+https://github.com/BananaLoaf/seedrandom.git
Usage
from seedrandom import SeededRNG
rng = SeededRNG(b"Test", b"values", hash_func=hashlib.sha512) # any hash func from hashlib
Generating random values:
rng.randint(a=0, b=1000) # 893
rng.randfloat(a=0, b=100, step=0.1) # 89.3
rng.randbool() # False
rng.randbyte() # b'\xbf'
SeededRNG can be converted to and from int or bytes:
bytes(rng)
int(rng)
rng1 = SeededRNG.from_bytes(b'\xbb\x9a\xf3\xe3\x1d\xfcA\xcc\xc5\x93S\x9a\xec:\x9a\x08z\x88\x85\x99\xf7\xea\x91\xb6x\x00\xfb\x82"\xc2$K', hash_func=hashlib.blake2s)
rng2 = SeededRNG.from_int(13391421701272821393603640485300504071883816826531413055648909144818643814535822212998295950921452703111178763035507290455800978052021014498426299707601814, hash_func=hashlib.sha512)
ordered parameter can be used:
rng1 = SeededRNG(b"Hello", b"world")
rng2 = SeededRNG(b"world", b"Hello")
rng1 == rng2 # True
rng1 = SeededRNG(ordered=(b"Hello", b"world"))
rng2 = SeededRNG(ordered=(b"world", b"Hello"))
rng1 == rng2 # False
rng1 = SeededRNG(b"Hello", b"world", ordered=(b"spanish", b"inquisition"))
rng2 = SeededRNG(b"world", b"Hello", ordered=(b"spanish", b"inquisition"))
rng1 == rng2 # True
rng1 = SeededRNG(b"Hello", b"world", ordered=(b"spanish", b"inquisition"))
rng2 = SeededRNG(b"Hello", b"world", ordered=(b"inquisition", b"spanish"))
rng1 == rng2 # False
Metadata
Release files for seedrandom 2.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| seedrandom-2.3.1.tar.gz | 4.6 kB | Without provenance | Details for seedrandom-2.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| seedrandom-2.3.1-py3-none-any.whl | Python 3 | none | any | Details for seedrandom-2.3.1-py3-none-any.whl |
Total release size: 9.3 kB
Release files / seedrandom-2.3.1.tar.gz
| Download URL | seedrandom-2.3.1.tar.gz |
|---|---|
| Size | 4.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a0f7ca322efe13ce4d3af28c9541b24b1945f63d5040e55479aadb45cad96696
|
|
BLAKE2b-256 checksum How to use checksums |
9f4505b800d1b070b1e805f71e59bcf5865178c6e58aa9d006d0539e373f45a9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.3.2 CPython/3.10.13 Linux/5.15.0-1041-azure
|
Release files / seedrandom-2.3.1-py3-none-any.whl
| Download URL | seedrandom-2.3.1-py3-none-any.whl |
|---|---|
| Size | 4.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5269632b66c9d7988cd6143a9f53510cd7d9fc06c90aefe92741f68fd0d90d5f
|
|
BLAKE2b-256 checksum How to use checksums |
481e422b52d2c82116f948bbae1715661b58a218dfedac2d0dfc6c5f4da735b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.3.2 CPython/3.10.13 Linux/5.15.0-1041-azure
|
Security for seedrandom 2.3.1
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.