Skip to main content

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 depend on any non-essential Python package.

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 set_manual_seeds    # import the seeding module from omnipyseed


if __name__ == '__main__':
    set_manual_seeds.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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

omnipyseed-0.0.4.tar.gz (15.7 kB view details)

Uploaded Source

Built Distribution

omnipyseed-0.0.4-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

Details for the file omnipyseed-0.0.4.tar.gz.

File metadata

  • Download URL: omnipyseed-0.0.4.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for omnipyseed-0.0.4.tar.gz
Algorithm Hash digest
SHA256 a792a4e59d8b4fce358ef3f40ef0ce8bb0b6f559c811f369dc67507907626b65
MD5 3128a89f4acba3b2ef280638b52eade2
BLAKE2b-256 a83dea83ac3e3751bfd17a5499c71d4bdbe6e06d5dcbb5eb833d34eb768c3269

See more details on using hashes here.

File details

Details for the file omnipyseed-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: omnipyseed-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 15.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for omnipyseed-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 25b5878f12fc7081ddd1a540565f22edaad6ff0db7d2c402a423a7782f196abd
MD5 4b8775c049fc05dcf93d5d078d70d2aa
BLAKE2b-256 d1ab16f62f3efaaeb50c76b02940d7fa73456e250cc4d5250b57f1cccca331b7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page