Common infrastructure for seeding random number generators.
Project description
Python Seed Manager
Python programs, particularly data science applications, often need to interact with multiple different random number generators.
This package provides a unified interface to seeding them, along with APIs for deriving additional RNG seeds in a predictable way (using NumPy 1.17's new random infrastructure) and constructing random generators.
Quick Start
To get started, just use the seedbank.initialize() function to seed all available random number generators:
import seedbank
seedbank.initialize(65000)
SeedBank will seed all of the known generators that will be available, including:
- Python standard random
- NumPy legacy random
numpy.random
- PyTorch (with
torch.manual_seed()
) - Numba’s NumPy random
- TensorFlow (with
tf.random.set_seed()
) - cupy (with
cupy.random.seed()
)
In addition, it will initialize a root seed for constructing new-style NumPy Generator
instances.
If SeedBank doesn’t support your RNG yet, please submit a pull request!
Developing SeedBank
The easiest way to set up your environment to develop seedbank is to install
uv
and just
, and run:
uv venv create
just install-dev
You can also set up dev dependencies with pip
:
pip install -e '.[dev,test,doc]
Acknowledgements
This material is based upon work supported by the National Science Foundation under Grant No. IIS 17-51278. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file seedbank-0.2.0b2.tar.gz
.
File metadata
- Download URL: seedbank-0.2.0b2.tar.gz
- Upload date:
- Size: 17.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8edbd449861c5dfc33aaa91377bbdb5f3d147a0b0c0da95996e2ef13a6764a55 |
|
MD5 | 88dd41e4b6a4f94bf798718ab51bc67a |
|
BLAKE2b-256 | 4d04eb001b969c174cb84ba431d67f0e3600657f41f116fdcd8b5a653bf4a32c |
File details
Details for the file seedbank-0.2.0b2-py3-none-any.whl
.
File metadata
- Download URL: seedbank-0.2.0b2-py3-none-any.whl
- Upload date:
- Size: 12.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 85dcb81cad82c6be60719aa2becb89645a2c3548352405e218cc1f4e8fcbab87 |
|
MD5 | 04bb2704d1d3dc173e295d2f84d460bd |
|
BLAKE2b-256 | 716d9fd049e8bb5e2b2906eaa8e1a113c97d172733442c02a08968dbd84bd810 |