Skip to main content

Contains implementations of Random Number Generators

Project description

gregs_rng

A package for generating random numbers using various methods. The current version only supports the Linear Congruential Method.

Linear Congruential Generator:

W. E. Thompson. 1958. A Modified Congruence Method of Generating Pseudo-Random Numbers. The Computer Journal 1, 2 (1958), 83–88. https://academic.oup.com/comjnl/article-abstract/1/2/83/425243

A. Rotenberg. 1960. A New Pseudo-Random Number Generator. Journal of the ACM 7, 1 (1960), 75–77. https://dl.acm.org/doi/10.1145/321008.321019 https://en.wikipedia.org/wiki/Linear_congruential_generator

Choice of parameters for LCG:

Donald E. Knuth (1981). The Art of Computer Programming, Volume 2: Seminumerical Algorithms (2nd ed.). Addison-Wesley. https://en.wikipedia.org/wiki/The_Art_of_Computer_Programming

Press, W. H., Teukolsky, S. A., Vetterling, W. T., & Flannery, B. P. Numerical Recipes in C: The Art of Scientific Computing, 2nd ed., Cambridge University Press, 1992. https://en.wikipedia.org/wiki/Numerical_Recipes

Mersenne Twister:

Makoto Matsumoto and Takuji Nishimura. 1998. Mersenne Twister: A 623-Dimensionally Equidistributed Uniform Pseudo-Random Number Generator. ACM Transactions on Modeling and Computer Simulation 8, 1 (1998), 3–30. https://dl.acm.org/doi/10.1145/272991.272995 https://en.wikipedia.org/wiki/Mersenne_Twister

Install:

pip install gregs_rng

Import and Use:

from gregs_rng import lcg, mtg

g = lcg(42)
print(next(g))
print(next(g))

g2 = mtg(42)
print(next(g2))
print(next(g2))

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

gregs_rng-0.1.13.tar.gz (21.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gregs_rng-0.1.13-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file gregs_rng-0.1.13.tar.gz.

File metadata

  • Download URL: gregs_rng-0.1.13.tar.gz
  • Upload date:
  • Size: 21.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for gregs_rng-0.1.13.tar.gz
Algorithm Hash digest
SHA256 b4608ea0dca97bfbf5438e6c20b19927bf88babe9394b1f62d63cc5844f45563
MD5 b87e6c7ec45d1ef1b0a7d6e86014c961
BLAKE2b-256 6636edf0ea965caa8d81b395447703d00260f6316a67d280977f41abf0b3e6d0

See more details on using hashes here.

Provenance

The following attestation bundles were made for gregs_rng-0.1.13.tar.gz:

Publisher: pypi.yml on gregdorshimer/gregs_rng

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gregs_rng-0.1.13-py3-none-any.whl.

File metadata

  • Download URL: gregs_rng-0.1.13-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for gregs_rng-0.1.13-py3-none-any.whl
Algorithm Hash digest
SHA256 74e35cf37f9614db7a3982a16d61f152938f1c19e729951a2ae128ab4f3e93e7
MD5 6fb517f98043c53a1b86b2ea51b09fe0
BLAKE2b-256 0e3a115674c3f3759a95c27090963cb1756117bec2c3974225337b2ea93fb4e8

See more details on using hashes here.

Provenance

The following attestation bundles were made for gregs_rng-0.1.13-py3-none-any.whl:

Publisher: pypi.yml on gregdorshimer/gregs_rng

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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