A tiny package for seeding all the RNGs in numerical experiments
Project description
omnipyseed
Omnipyseed is a minimal Python package that seeds all the basic Random Number Generators (RNGs) in a Python script. The purpose of omnipyseed is to simplify the process of seeding numerical simulations which use packages such as Numpy and Pytorch.
Dependencies
omnipyseed does not require any non-essential Python package. In case Numpy or Pytorch are not installed on the system and are not used in the source code they will be ignored from omnipyseed.
Installation
You can install omnipyseed using pip:
pip3 (or pip) install omnipyseed
Or you can clone this repository to any of your local directories and install it from there.
$ git clone https://github.com/gdetor/omnipyseed.git
$ cd omnipyseed/
$ pip install .
How to use
import numpy as np
from omnipyseed import seeding # import the seeding module from omnipyseed
if __name__ == '__main__':
seeding.universal_seed(13) # call the universal_seed function to seed
# Python and Numpy
x = np.linspace(-1, 1, 10)
y = np.sin(2*np.pi*5*x)
print(y)
Caveat
Please do not use omnipyseed if you'd like to use different random states for different random parts of your project. Instead you should instantiate generator objects with a seed and pass it around (e.g., numpy.random.default_rng(seed)).
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
Hashes for omnipyseed-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9e2642df2450397dd40b738a46f9c7c9023aea8c44ba0364cdd22130b203af8 |
|
MD5 | ce7704ffe5f38e141cdc9b19b0e7ff1e |
|
BLAKE2b-256 | 02e05c3b36336649acb3f9c14fa86839cafc9ca261b4943174aa38d1334916dc |