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
Coverage
Latest Release
License
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 broadcastinguintegers
: fast 32 and 64-bit uniform integerscomplex_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 DeprecationWarning
s 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 BigGenerator
s).
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
andRandomState
. 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
, andHC128
. - 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, 3.9)
- 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 (6+).
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
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 Distributions
Built Distributions
File details
Details for the file randomgen-1.20.0-cp39-cp39-win_amd64.whl
.
File metadata
- Download URL: randomgen-1.20.0-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 6.1 MB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ec9941332cd329fc94d01d8d417f5d36109d07fda533ee3c45909460f1cbb73 |
|
MD5 | 734cb61ec381d216356579d65c1dec6a |
|
BLAKE2b-256 | bcadc71069218c9c8548594d80e77660246d7d7c9598969dc740ba38847a5e60 |
File details
Details for the file randomgen-1.20.0-cp39-cp39-win32.whl
.
File metadata
- Download URL: randomgen-1.20.0-cp39-cp39-win32.whl
- Upload date:
- Size: 5.8 MB
- Tags: CPython 3.9, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8781ad2d660d9d586f6f5a2e86b9a2938bece7630674f7366f852f54c274d61 |
|
MD5 | 4dacda577e0ae8733eac9e8bae7d92b3 |
|
BLAKE2b-256 | d66425911e960bf9af01c6afd0ad616a3e92c4c31b4d6a2d0eac623f003a4d15 |
File details
Details for the file randomgen-1.20.0-cp39-cp39-manylinux1_x86_64.whl
.
File metadata
- Download URL: randomgen-1.20.0-cp39-cp39-manylinux1_x86_64.whl
- Upload date:
- Size: 3.2 MB
- Tags: CPython 3.9
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b0b41b09e5db00472ee40c4e173beaf4a3c78f87ef6faa424dcfc83255254592 |
|
MD5 | 8d5b9f9ce6b60d6b5ebbff3b0882dd70 |
|
BLAKE2b-256 | 650a730c11ea55e9929d2cc6503c20c4ba427d6155d2e83126cc8be0b31ffd0c |
File details
Details for the file randomgen-1.20.0-cp39-cp39-manylinux1_i686.whl
.
File metadata
- Download URL: randomgen-1.20.0-cp39-cp39-manylinux1_i686.whl
- Upload date:
- Size: 3.2 MB
- Tags: CPython 3.9
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 088780c6a469f6913a27e44cd4b29dae1d009c03eb2b78dd7ce988f0551860e4 |
|
MD5 | eb59795f1e75b5abf1a5ffef6691453b |
|
BLAKE2b-256 | 7c1c39dafbafcb68187a680be65a1e239b585976b7f38a7cfa502d1484a8d6a4 |
File details
Details for the file randomgen-1.20.0-cp39-cp39-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: randomgen-1.20.0-cp39-cp39-macosx_10_9_x86_64.whl
- Upload date:
- Size: 3.4 MB
- Tags: CPython 3.9, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9aeb3798e388bc6448513702e0ebe717841f4b3e13134d1ac10757b916355180 |
|
MD5 | d27be9f2608ab7e512657fa9b8e60500 |
|
BLAKE2b-256 | 1172e9e70779b83fd54e27803f126550d357282191314f66816d470dbeceb2ea |
File details
Details for the file randomgen-1.20.0-cp38-cp38-win_amd64.whl
.
File metadata
- Download URL: randomgen-1.20.0-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 6.3 MB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a037b3aeb09fbaf25a56124d85d326bf62543b669b0b9e2b3b7c93d64aac4589 |
|
MD5 | 9660c11a3a8707e9402925544314f1b5 |
|
BLAKE2b-256 | 09336dc58014f1bf6f5ea221f567ff89bab298988e829e5e7b64fbbbb8de0922 |
File details
Details for the file randomgen-1.20.0-cp38-cp38-win32.whl
.
File metadata
- Download URL: randomgen-1.20.0-cp38-cp38-win32.whl
- Upload date:
- Size: 6.1 MB
- Tags: CPython 3.8, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f145887b3cb2f2371bef1472af12373d33ce9e12e86c9708446c6e3c5669212f |
|
MD5 | b0c70f771fba7a801e7863bd4e5fde16 |
|
BLAKE2b-256 | db7c481d8a105482e75932a07d5c2cd1026a7ad59a730c1ae27dc14fe05a9f14 |
File details
Details for the file randomgen-1.20.0-cp38-cp38-manylinux1_x86_64.whl
.
File metadata
- Download URL: randomgen-1.20.0-cp38-cp38-manylinux1_x86_64.whl
- Upload date:
- Size: 3.3 MB
- Tags: CPython 3.8
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1777a68020c1779ae8344ff280ceaad44ce63a8d94b1f42ca96ba1859122a48a |
|
MD5 | 46eda8f1dfc2c01e8fc40de05b7c60be |
|
BLAKE2b-256 | e2276a0f8c2c2a181dd991b7fb5a332cebb10b108b7bbabd43ba8ed396f9781b |
File details
Details for the file randomgen-1.20.0-cp38-cp38-manylinux1_i686.whl
.
File metadata
- Download URL: randomgen-1.20.0-cp38-cp38-manylinux1_i686.whl
- Upload date:
- Size: 3.2 MB
- Tags: CPython 3.8
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 65dbb49ecf81779dfd630d387246bd51cec75d0f54a5f1e123c007eb7f53ebf5 |
|
MD5 | 7e7d074cec94b15a12f52e00ff9d352f |
|
BLAKE2b-256 | 80876a04bfe66222003224f0f99b7049102d5ddddbaeaf770e4429e2a4a3591b |
File details
Details for the file randomgen-1.20.0-cp38-cp38-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: randomgen-1.20.0-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.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 08b8013126e9ea0dad7d378c846b0b6a5254b88e1b388de4c0e548bff04cef9e |
|
MD5 | cd79889a3292de91b3d08fc924c11bae |
|
BLAKE2b-256 | 0e7a693e75b626c45044b14fcdad594beb589fa53ddbe09ecc37c87d1fc3e0f9 |
File details
Details for the file randomgen-1.20.0-cp37-cp37m-win_amd64.whl
.
File metadata
- Download URL: randomgen-1.20.0-cp37-cp37m-win_amd64.whl
- Upload date:
- Size: 6.3 MB
- Tags: CPython 3.7m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a9e7ab539402412ef4235044d3820e663741e3fa811513db749d574168e2022 |
|
MD5 | 01f5384ffa69464cad6edfd2c3417408 |
|
BLAKE2b-256 | f341026f9c55d1874014c1581082fff8029bd7b3c0930062c7744b882a637e0f |
File details
Details for the file randomgen-1.20.0-cp37-cp37m-win32.whl
.
File metadata
- Download URL: randomgen-1.20.0-cp37-cp37m-win32.whl
- Upload date:
- Size: 6.1 MB
- Tags: CPython 3.7m, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 42c405967d395e8aae0b8b4161c1808960770eb40dd1c69631cea1e845ca2a90 |
|
MD5 | 96a6812f5c2e52519baf0cc34262eedc |
|
BLAKE2b-256 | a67ecf6ce26b509a9b428575f66191ab3b85788a59965639e98b00a3e5c930cc |
File details
Details for the file randomgen-1.20.0-cp37-cp37m-manylinux1_x86_64.whl
.
File metadata
- Download URL: randomgen-1.20.0-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.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93f88268a96d12b9f314f6a320ad4c9c9a15b89a2c48aad9825aec45b7654f23 |
|
MD5 | d3e39de2db7b3294cf6fe5038d0074d5 |
|
BLAKE2b-256 | c802f4d7c18437c73d7fe8afa45c7b4101d41fb1ccaee9dac2716cae89a1314b |
File details
Details for the file randomgen-1.20.0-cp37-cp37m-manylinux1_i686.whl
.
File metadata
- Download URL: randomgen-1.20.0-cp37-cp37m-manylinux1_i686.whl
- Upload date:
- Size: 3.2 MB
- Tags: CPython 3.7m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f1143bff1e5a2c6e33f5b8d6371b40bed3096dea154800661d29f66a2717b7fa |
|
MD5 | 3e8b8ccaff55c2e0401dd1502e6f1f8e |
|
BLAKE2b-256 | 4eda8d573b89fd5ee5358c98367bbf26c50f7a3e4ff70529cfc0be88ecf601b0 |
File details
Details for the file randomgen-1.20.0-cp37-cp37m-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: randomgen-1.20.0-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.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f8c630533e2eaeab27899c524a75db5fdc124b54edf1b628f9ca21475613774 |
|
MD5 | 0ff87fcc8e9f36b198abf73ced05d67c |
|
BLAKE2b-256 | 8618679f0fa2c7485aa181031232345b61ee55151987918c2f59a9e6b0b1e7f8 |
File details
Details for the file randomgen-1.20.0-cp36-cp36m-win_amd64.whl
.
File metadata
- Download URL: randomgen-1.20.0-cp36-cp36m-win_amd64.whl
- Upload date:
- Size: 6.3 MB
- Tags: CPython 3.6m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ed3799277d98b6980048e89d646400ef5f03ae49c554726f27241f8659b00d38 |
|
MD5 | 2e0277be65451d789770388baa079df7 |
|
BLAKE2b-256 | 9651f33b18d91505dad8bad7556fef2d4cf10812d66dbd6cecff783910ae05dd |
File details
Details for the file randomgen-1.20.0-cp36-cp36m-win32.whl
.
File metadata
- Download URL: randomgen-1.20.0-cp36-cp36m-win32.whl
- Upload date:
- Size: 6.1 MB
- Tags: CPython 3.6m, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a7c27047f7cf58bde3b497d236884cb02d4f54d24347ed6ff91374e0f9b0a57f |
|
MD5 | bc1bf04f2d845ea4c110a092b5f12078 |
|
BLAKE2b-256 | 2f04803fa2ffd61c37e3a1b195b2eab3f7abbaa0b376e603394df4a635f5e16f |
File details
Details for the file randomgen-1.20.0-cp36-cp36m-manylinux1_x86_64.whl
.
File metadata
- Download URL: randomgen-1.20.0-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.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.6.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f1f279deeb54d516ca5c983923a57694dd8634983be58322aee4915ec0781056 |
|
MD5 | 5e313566870af21acad424a05b2b4e78 |
|
BLAKE2b-256 | 7905d0f2f3e3689779e31e97a2902e116960c82f1c218c98725b502dc8115304 |
File details
Details for the file randomgen-1.20.0-cp36-cp36m-manylinux1_i686.whl
.
File metadata
- Download URL: randomgen-1.20.0-cp36-cp36m-manylinux1_i686.whl
- Upload date:
- Size: 3.2 MB
- Tags: CPython 3.6m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.6.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bcaa043b99dd441a68e2441dc38b2056ef0b0d89474220a72caa5d8abdf1fe63 |
|
MD5 | 191876a47fd774370a58ef0610430b64 |
|
BLAKE2b-256 | b49d75b3e39bbc0e4b7678dcd6daf2bb411a91c62e4fa2f900fd0d2ed7d30be4 |
File details
Details for the file randomgen-1.20.0-cp36-cp36m-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: randomgen-1.20.0-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.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.6.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec53413eeffcc33cb2cad0d073a5cc4a6a73e30cacc45e2e19b269b551f181a9 |
|
MD5 | 1fe420fa139f7251eb99520c51111829 |
|
BLAKE2b-256 | bf873fe308827e92bda341bb8080074205f1e0f3a957d6538b5eded34b5e17dc |