Skip to main content

Random generator supporting multiple PRNGs

Project description

RandomGen

This package contains additional bit generators for NumPy's Generator and an ExtendedGenerator exposing methods not in Generator.

Continuous Integration

Travis Build Status Appveyor Build Status Build Status FreeBSD Status on Cirrus

Coverage

Coverage Status codecov

Latest Release

PyPI version Anacnoda Cloud

License

NCSA License BSD License DOI

This is a library and generic interface for alternative random generators in Python and NumPy.

New Features

The the development documentation for the latest features, or the stable documentation for the latest released features.

WARNINGS

Changes in v1.19

Generator and RandomState have been officially deprecated, and will warn with a FutureWarning about their removal. They will also receive virtually no maintenance. It is now time to move to NumPy's np.random.Generator which has features not in randomstate.Generator and is maintained more actively.

A few distributions that are not present in np.random.Generator have been moved to randomstate.ExtendedGenerator:

  • multivariate_normal: which supports broadcasting
  • uintegers: fast 32 and 64-bit uniform integers
  • complex_normal: scalar complex normals

There are no plans to remove any of the bit generators, e.g., AESCounter, ThreeFry, or PCG64.

Changes in v1.18

There are many changes between v1.16.x and v1.18.x. These reflect API decision taken in conjunction with NumPy in preparation of the core of randomgen being used as the preferred random number generator in NumPy. These all issue DeprecationWarnings except for BasicRNG.generator which raises NotImplementedError. The C-API has also changed to reflect the preferred naming the underlying Pseudo-RNGs, which are now known as bit generators (or BigGenerators).

Future Plans

A substantial portion of randomgen has been merged into NumPy. Revamping NumPy's random number generation was always the goal of this project (and its predecessor NextGen NumPy RandomState), and so it has succeeded.

While I have no immediate plans to remove anything, after a 1.19 release I will:

  • Remove Generator and RandomState. These duplicate NumPy and will diverge over time. The versions in NumPy are authoritative. Deprecated
  • Preserve novel methods of Generator in a new class, ExtendedGenerator. Done
  • Add some distributions that are not supported in NumPy. Ongoing
  • Add any interesting bit generators I come across. Recent additions include the DXSM and CM-DXSM variants of PCG64 and the LXM generator.

Included Pseudo Random Number Generators

This module includes a number of alternative random number generators in addition to the MT19937 that is included in NumPy. The RNGs include:

  • Cryptographic cipher-based random number generator based on AES, ChaCha20, HC128 and Speck128.
  • MT19937, the NumPy rng
  • dSFMT a SSE2-aware version of the MT19937 generator that is especially fast at generating doubles
  • xoroshiro128+, xorshift1024*φ, xoshiro256**, and xoshiro512**
  • PCG64
  • ThreeFry and Philox from Random123
  • Other cryptographic-based generators: AESCounter, SPECK128, ChaCha, and HC128.
  • Hardware (non-reproducible) random number generator on AMD64 using RDRAND.
  • Chaotic PRNGS: Small-Fast Chaotic (SFC64) and Jenkin's Small-Fast (JSF).

Status

  • Builds and passes all tests on:
    • Linux 32/64 bit, Python 2.7, 3.5, 3.6, 3.7
    • Linux (ARM/ARM64), Python 3.7
    • OSX 64-bit, Python 2.7, 3.5, 3.6, 3.7
    • Windows 32/64 bit, Python 2.7, 3.5, 3.6, 3.7
    • FreeBSD 64-bit

Version

The package version matches the latest version of NumPy where Generator(MT19937()) passes all NumPy test.

Documentation

Documentation for the latest release is available on my GitHub pages. Documentation for the latest commit (unreleased) is available under devel.

Requirements

Building requires:

  • Python (3.6, 3.7, 3.8)
  • NumPy (1.14, 1.15, 1.16, 1.17, 1.18, 1.19)
  • Cython (0.29+)
  • tempita (0.5+), if not provided by Cython

Testing requires pytest (5.0.1+).

Note: it might work with other versions but only tested with these versions.

Development and Testing

All development has been on 64-bit Linux, and it is regularly tested on Travis-CI (Linux-AMD64, Linux-PPC-LE, Linus-S390X, and OSX), Appveyor (Windows 32/64), Cirrus (FreeBSD) and Drone.io (ARM/ARM64 Linux).

Tests are in place for all RNGs. The MT19937 is tested against NumPy's implementation for identical results. It also passes NumPy's test suite where still relevant.

Installing

Either install from PyPi using

pip install randomgen

or, if you want the latest version,

pip install git+https://github.com/bashtage/randomgen.git

or from a cloned repo,

python setup.py install

If you use conda, you can install using conda forge

conda install -c conda-forge randomgen

SSE2

dSFTM makes use of SSE2 by default. If you have a very old computer or are building on non-x86, you can install using:

python setup.py install --no-sse2

Windows

Either use a binary installer, or if building from scratch, use Python 3.6/3.7 with Visual Studio 2015 Build Toolx.

License

Dual: BSD 3-Clause and NCSA, plus sub licenses for components.

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

randomgen-1.19.3.tar.gz (1.3 MB view details)

Uploaded Source

Built Distributions

randomgen-1.19.3-cp38-cp38-win_amd64.whl (6.2 MB view details)

Uploaded CPython 3.8 Windows x86-64

randomgen-1.19.3-cp38-cp38-win32.whl (6.0 MB view details)

Uploaded CPython 3.8 Windows x86

randomgen-1.19.3-cp38-cp38-manylinux1_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.8

randomgen-1.19.3-cp38-cp38-manylinux1_i686.whl (3.2 MB view details)

Uploaded CPython 3.8

randomgen-1.19.3-cp38-cp38-macosx_10_9_x86_64.whl (3.3 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

randomgen-1.19.3-cp37-cp37m-win_amd64.whl (6.1 MB view details)

Uploaded CPython 3.7m Windows x86-64

randomgen-1.19.3-cp37-cp37m-win32.whl (5.9 MB view details)

Uploaded CPython 3.7m Windows x86

randomgen-1.19.3-cp37-cp37m-manylinux1_x86_64.whl (3.3 MB view details)

Uploaded CPython 3.7m

randomgen-1.19.3-cp37-cp37m-manylinux1_i686.whl (3.2 MB view details)

Uploaded CPython 3.7m

randomgen-1.19.3-cp37-cp37m-macosx_10_9_x86_64.whl (3.3 MB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

randomgen-1.19.3-cp36-cp36m-win_amd64.whl (6.1 MB view details)

Uploaded CPython 3.6m Windows x86-64

randomgen-1.19.3-cp36-cp36m-win32.whl (5.9 MB view details)

Uploaded CPython 3.6m Windows x86

randomgen-1.19.3-cp36-cp36m-manylinux1_x86_64.whl (3.3 MB view details)

Uploaded CPython 3.6m

randomgen-1.19.3-cp36-cp36m-manylinux1_i686.whl (3.2 MB view details)

Uploaded CPython 3.6m

randomgen-1.19.3-cp36-cp36m-macosx_10_9_x86_64.whl (3.3 MB view details)

Uploaded CPython 3.6m macOS 10.9+ x86-64

File details

Details for the file randomgen-1.19.3.tar.gz.

File metadata

  • Download URL: randomgen-1.19.3.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0.post20200714 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.7

File hashes

Hashes for randomgen-1.19.3.tar.gz
Algorithm Hash digest
SHA256 e0f8596ad6f595900ac0cc8463c6366f0a763b5b8f8e81cdd38fd7fb3d717ddc
MD5 b5f6d8194e66e286cc3dd7fb2ab1ea1f
BLAKE2b-256 36272579cecb6cfe7e6b6c88e97e98969a5feb9ac1489270d44770a3c4074615

See more details on using hashes here.

File details

Details for the file randomgen-1.19.3-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: randomgen-1.19.3-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 6.2 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.0

File hashes

Hashes for randomgen-1.19.3-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 4ebd79556e2c48bf609c8652921983460ce3496c2a1bffb76ac7250a495e454b
MD5 0da343c796d1aabe2d79508a9ecd816a
BLAKE2b-256 89583578c811dff0dcab9aa30f7c8e0a8365f2ea5b35ae6c7dde7407ffee141d

See more details on using hashes here.

File details

Details for the file randomgen-1.19.3-cp38-cp38-win32.whl.

File metadata

  • Download URL: randomgen-1.19.3-cp38-cp38-win32.whl
  • Upload date:
  • Size: 6.0 MB
  • Tags: CPython 3.8, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.0

File hashes

Hashes for randomgen-1.19.3-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 1655c58662861af5a087f5dc147721c2ca5cde4b7ea4ad287d56d0a2948ae523
MD5 3b9c7838e65f944264524c6f3307b136
BLAKE2b-256 187d1d1b9c8a0e808cd27c5d4ce5cd909cf65035fda3ed63a71d86b5fe01e180

See more details on using hashes here.

File details

Details for the file randomgen-1.19.3-cp38-cp38-manylinux1_x86_64.whl.

File metadata

  • Download URL: randomgen-1.19.3-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 3.2 MB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.6.7

File hashes

Hashes for randomgen-1.19.3-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 e6e2ae353b3fe3188a60ea38f5982fef27210ddfda8cca0387654ae0182a5c3f
MD5 5cd76e7d03ec1b67498526fd54c4e1b0
BLAKE2b-256 cc785b65bd1c306b64a98cdc13afc37b747476c77fd59f811c4b5168bdd0e172

See more details on using hashes here.

File details

Details for the file randomgen-1.19.3-cp38-cp38-manylinux1_i686.whl.

File metadata

  • Download URL: randomgen-1.19.3-cp38-cp38-manylinux1_i686.whl
  • Upload date:
  • Size: 3.2 MB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.6.7

File hashes

Hashes for randomgen-1.19.3-cp38-cp38-manylinux1_i686.whl
Algorithm Hash digest
SHA256 d4684de385cb84f9f3b12eb3542c0c7b29643adf062a96025e076c096c5bae12
MD5 f4ce7a0e726e33f929accd7d09fe3a6e
BLAKE2b-256 f78741cc65469a44fd3b7b1825e3d389b9faba74af4995c2c349fbd58a24159e

See more details on using hashes here.

File details

Details for the file randomgen-1.19.3-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: randomgen-1.19.3-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 3.3 MB
  • Tags: CPython 3.8, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.6.8

File hashes

Hashes for randomgen-1.19.3-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b62449455a14f36bdfdfda4ea6064fb6c6c648cbf3bc61a26636d40bb68c4082
MD5 b40d79fbd9c102fff1353824294db2f7
BLAKE2b-256 f70613481d6e9d4f1d9dabfa3c9740ddfb2de2b381468d257ead62bce4b693f4

See more details on using hashes here.

File details

Details for the file randomgen-1.19.3-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: randomgen-1.19.3-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 6.1 MB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.5

File hashes

Hashes for randomgen-1.19.3-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 41eaa22fe0bae856d8ffa2b2bfe724cf6a55e31abac8f9137c37776f5b260554
MD5 ce833546027c9d946f0be75aad472c95
BLAKE2b-256 c1a7507308105ade3baa26dec6487e567d458db96a881fd843bd3a4e9b070914

See more details on using hashes here.

File details

Details for the file randomgen-1.19.3-cp37-cp37m-win32.whl.

File metadata

  • Download URL: randomgen-1.19.3-cp37-cp37m-win32.whl
  • Upload date:
  • Size: 5.9 MB
  • Tags: CPython 3.7m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.5

File hashes

Hashes for randomgen-1.19.3-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 0380d2030f87db94d2af44e171797f689da055244e1a6e4404e55ff8da758299
MD5 6c1a48453e4c0488c6d253d7c058c3be
BLAKE2b-256 5fc31899a212b0227501736798e7d98b4799428f2ac821e1fc0e8b4813f29b00

See more details on using hashes here.

File details

Details for the file randomgen-1.19.3-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

  • Download URL: randomgen-1.19.3-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 3.3 MB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.6.7

File hashes

Hashes for randomgen-1.19.3-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 ba57ae28b67e9d7d8b68f6b17f799a406f83605f1d2b148c3dadf0f82ab9d9c5
MD5 7230065ac732bdfb1b76823afb7fb68b
BLAKE2b-256 5a6bfc2f2cf8075540dee7aebe57da9b6faa62ba981835d96bcdd3ae4b964a39

See more details on using hashes here.

File details

Details for the file randomgen-1.19.3-cp37-cp37m-manylinux1_i686.whl.

File metadata

  • Download URL: randomgen-1.19.3-cp37-cp37m-manylinux1_i686.whl
  • Upload date:
  • Size: 3.2 MB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.6.7

File hashes

Hashes for randomgen-1.19.3-cp37-cp37m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 972e362ba61cb64f47f05b71f2802725261f7dc1b838b522ecee415b4ec72388
MD5 a8cfa140b7118d5dc7daa6ed1320245c
BLAKE2b-256 6e32f273b3f770e5497a12c528cb7b711d6009dfcf6b76829b2b9a03c9491028

See more details on using hashes here.

File details

Details for the file randomgen-1.19.3-cp37-cp37m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: randomgen-1.19.3-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 3.3 MB
  • Tags: CPython 3.7m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.6.8

File hashes

Hashes for randomgen-1.19.3-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8cab491dba788a8aab2787d85934158277a30eff302be4bf1cb347362e9eeeeb
MD5 6887231d33541448361c89279d3171cb
BLAKE2b-256 11e22508f40d7045f9c8f17f38bf917a327be166eb174ae5fba543cb8808b3c9

See more details on using hashes here.

File details

Details for the file randomgen-1.19.3-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: randomgen-1.19.3-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 6.1 MB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.6.8

File hashes

Hashes for randomgen-1.19.3-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 881eef6eceb0cb5e21c9d7a4f71cda9fedb03eb3a81a67807c8a584561858868
MD5 3e716f82c80b941486b8b610ab3fc393
BLAKE2b-256 5f1169330f6af5205514ea49790c08ff1a6087efc7ca6e262d96d3f30077c9a2

See more details on using hashes here.

File details

Details for the file randomgen-1.19.3-cp36-cp36m-win32.whl.

File metadata

  • Download URL: randomgen-1.19.3-cp36-cp36m-win32.whl
  • Upload date:
  • Size: 5.9 MB
  • Tags: CPython 3.6m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.6.8

File hashes

Hashes for randomgen-1.19.3-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 f9f44dcf04a70db15f8ea46654473ad3ba1efbffa2c075c7b76c5f7d8688a4de
MD5 d0b56ec19c5d351f8fd7de23605d344c
BLAKE2b-256 2bb4bad16b3c4024bb79eafa83a7c28b70752854ed8139053bc1087aeb647650

See more details on using hashes here.

File details

Details for the file randomgen-1.19.3-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

  • Download URL: randomgen-1.19.3-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 3.3 MB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.6.7

File hashes

Hashes for randomgen-1.19.3-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 b719d946394719bafd0d6b5af3a80352fd6c6f6cbda4f390fede77ad8fccea70
MD5 657294bb56cc92c2fe0932102aa5042f
BLAKE2b-256 58a9953fae73a98c906d016e3085ee9125949e4469dae1e08fb37ee8a39ad900

See more details on using hashes here.

File details

Details for the file randomgen-1.19.3-cp36-cp36m-manylinux1_i686.whl.

File metadata

  • Download URL: randomgen-1.19.3-cp36-cp36m-manylinux1_i686.whl
  • Upload date:
  • Size: 3.2 MB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.6.7

File hashes

Hashes for randomgen-1.19.3-cp36-cp36m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 9a3555ef86ce4fbcecdc2d1960acae03cccdc24ace1275be23d6a9d0d3b8daab
MD5 0f7f79568a7632863c50fda9024bbdad
BLAKE2b-256 2351b995a978cb12fd155424dff84c908ff6aee0ab930fba85d5cb35241de4d7

See more details on using hashes here.

File details

Details for the file randomgen-1.19.3-cp36-cp36m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: randomgen-1.19.3-cp36-cp36m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 3.3 MB
  • Tags: CPython 3.6m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.6.8

File hashes

Hashes for randomgen-1.19.3-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 363e8f623713c779b1fa79515526a0614dc78dcd43aa3e5d4ccf2f117b55cd3e
MD5 7917b93dff2a5a5b3a921bcae419c12a
BLAKE2b-256 413815234ee003853ba5fc8dca03f19c0f42dbb07197106bd1ff3bd80acfd8bb

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