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

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.0.tar.gz (1.2 MB view details)

Uploaded Source

Built Distributions

randomgen-1.19.0-cp38-cp38-win_amd64.whl (5.9 MB view details)

Uploaded CPython 3.8 Windows x86-64

randomgen-1.19.0-cp38-cp38-win32.whl (5.7 MB view details)

Uploaded CPython 3.8 Windows x86

randomgen-1.19.0-cp38-cp38-manylinux1_x86_64.whl (3.1 MB view details)

Uploaded CPython 3.8

randomgen-1.19.0-cp38-cp38-manylinux1_i686.whl (3.0 MB view details)

Uploaded CPython 3.8

randomgen-1.19.0-cp38-cp38-macosx_10_9_x86_64.whl (3.1 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

randomgen-1.19.0-cp37-cp37m-win_amd64.whl (5.8 MB view details)

Uploaded CPython 3.7m Windows x86-64

randomgen-1.19.0-cp37-cp37m-win32.whl (5.6 MB view details)

Uploaded CPython 3.7m Windows x86

randomgen-1.19.0-cp37-cp37m-manylinux1_x86_64.whl (3.1 MB view details)

Uploaded CPython 3.7m

randomgen-1.19.0-cp37-cp37m-manylinux1_i686.whl (3.0 MB view details)

Uploaded CPython 3.7m

randomgen-1.19.0-cp37-cp37m-macosx_10_9_x86_64.whl (3.1 MB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

randomgen-1.19.0-cp36-cp36m-win_amd64.whl (5.8 MB view details)

Uploaded CPython 3.6m Windows x86-64

randomgen-1.19.0-cp36-cp36m-win32.whl (5.6 MB view details)

Uploaded CPython 3.6m Windows x86

randomgen-1.19.0-cp36-cp36m-manylinux1_x86_64.whl (3.1 MB view details)

Uploaded CPython 3.6m

randomgen-1.19.0-cp36-cp36m-manylinux1_i686.whl (3.0 MB view details)

Uploaded CPython 3.6m

randomgen-1.19.0-cp36-cp36m-macosx_10_9_x86_64.whl (3.1 MB view details)

Uploaded CPython 3.6m macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: randomgen-1.19.0.tar.gz
  • Upload date:
  • Size: 1.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1.post20200604 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7

File hashes

Hashes for randomgen-1.19.0.tar.gz
Algorithm Hash digest
SHA256 c84d215cc995ef84fd9557ca3410bffa5c60ead19cb154bca0068dc6fe83cc55
MD5 843b240edbe9b2cb16c21ad0c3bdfd32
BLAKE2b-256 9692a5b33a02dd8339cc6aef8dd77107867d0e520a091a0afdb4b072f9dcda88

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for randomgen-1.19.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 ea4c9b042f41f4b727378905cdcc858217b561e7aeb50fc6c4da89fd267bbbcb
MD5 eb8c96be6711ba6f605522fb9ef72ede
BLAKE2b-256 1acef03ff0eca303a3bdf3310e12f8948074a4e31ad77c73bf2572a617cc5d0b

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for randomgen-1.19.0-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 f9abf9b18100171e99fc4fa7998f5ccbf6e0ca4436fc38225f8edc7d5dc979a6
MD5 75b7e3eef75570d2445c56c1cadc33bb
BLAKE2b-256 7869702ffa55c4d741715321690d6251b61d98c9ece5263388803482b25434d7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: randomgen-1.19.0-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 3.1 MB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.7

File hashes

Hashes for randomgen-1.19.0-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 8e8639c5752b367033ca34267f5ddfacb31c80ec96716c0ed539bec66e65cdc7
MD5 81ba592440b95d46576d96a954f8ebac
BLAKE2b-256 1fd158bf2a82beffe57986a6badb32ccda06ee1dae3b34278ae2fc6679fbe2ee

See more details on using hashes here.

File details

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

File metadata

  • Download URL: randomgen-1.19.0-cp38-cp38-manylinux1_i686.whl
  • Upload date:
  • Size: 3.0 MB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.7

File hashes

Hashes for randomgen-1.19.0-cp38-cp38-manylinux1_i686.whl
Algorithm Hash digest
SHA256 7222335246fa1fd31e1488090cc0ff631435d7a742f00e8d4cd9c520208eeaa3
MD5 b3ef4cf63791222c82e9b0fcc8a22f66
BLAKE2b-256 90d440ae784f9ab113b978d1958985a4606faf83a509f561f6337ebbd22e4e4d

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for randomgen-1.19.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 61e2ee592da471281703688b14fb06327d1b90c9fecf1a6698c77fc7f5b9a182
MD5 135118a2ccf8447c2e0b192b3d66cfae
BLAKE2b-256 f03272190431402739db7993c1419e710ae86925c815349270b391c6c483abbc

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for randomgen-1.19.0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 92b56dc33a43009e4fb7503f8edf7fc2613cde0fb89e640df22509cab5293d9b
MD5 be2c7eb1f191cfaffac22db9ea642985
BLAKE2b-256 ceb1ae6ea4dbf41e0901593a256f70b0c8d0adde7928925ca9fa14be64a3831c

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for randomgen-1.19.0-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 3706896e2bdf4d2cb9a4a3cf6633db305f9ad5790174db9644f79505c3cb1576
MD5 19c91f083847ecdc91ff971f096bc54c
BLAKE2b-256 c33c729ca359c1369567a9b36c7a0908624f7cdec0ce28c95d31b7a2d87508f9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: randomgen-1.19.0-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 3.1 MB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.7

File hashes

Hashes for randomgen-1.19.0-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 d9b8487b57ddd6252f2cdc50c4668f58ceeb1f2e87359963dacdbf6cb3661f8f
MD5 082457814a1c3ebb99fd81bc39e8dc5c
BLAKE2b-256 6b69a44c63bd7513a39c5469a3d648f4a3e83d33aa821a964d15db1af98efa6e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: randomgen-1.19.0-cp37-cp37m-manylinux1_i686.whl
  • Upload date:
  • Size: 3.0 MB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.7

File hashes

Hashes for randomgen-1.19.0-cp37-cp37m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 45c3aa6915a61c3bb350ef8f1d510556b53fa5fa2f834a11e05853302902d145
MD5 b95445a3c0b88ad6b1dd2e4baf9b5b0a
BLAKE2b-256 8a3165908f3ae1fda2b50a713e8d6ed80aac50adb51ce597eb2905347cc2daf0

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for randomgen-1.19.0-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c94a12a8d244b4292b473efd2e7c2c35a129a30e2721fdd8a98d0ddeb5689912
MD5 64692b672734d3c05097305787ee10ab
BLAKE2b-256 5ec8e7b0953283084363270e079208d089c1311cc4d678efc8136c8516266db7

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for randomgen-1.19.0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 4c9fc83f56007b6129cf43f0204ef41f1177661ef07a93bf49d420ca299cfb8a
MD5 81adfa105f8e4abb01a034b3955a7c7b
BLAKE2b-256 462191d64e31f8134396726761af5cf6a2f8f75e53f43710bd17addee942f852

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for randomgen-1.19.0-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 0b3c3737e97bf0038e734b94365a980cbcfc77be88ca35167253bbd4bf8fc782
MD5 761566734c5c1dc5f22d3d4e14e1216b
BLAKE2b-256 173987e7c668c8f7a63eef3ecdfd452812e83c96f8039cdc351418864efdcf62

See more details on using hashes here.

File details

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

File metadata

  • Download URL: randomgen-1.19.0-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 3.1 MB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.7

File hashes

Hashes for randomgen-1.19.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 827e8f4997df5bc9715487abfafa46826e8757771dabcffd9a8b6b12c3906710
MD5 71c5482b52441022107df7b4bd1d1743
BLAKE2b-256 1185c257f9ccefff93789bef893a5c29eb58940958a9c8c0ba70365ca33e4615

See more details on using hashes here.

File details

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

File metadata

  • Download URL: randomgen-1.19.0-cp36-cp36m-manylinux1_i686.whl
  • Upload date:
  • Size: 3.0 MB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.7

File hashes

Hashes for randomgen-1.19.0-cp36-cp36m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 4f2fe57e98a3e833120cfbd1b738bac4f8a35a4ce756b8d3add183b263b9fef6
MD5 1ff50f71eaa0a6599e1024487feb9595
BLAKE2b-256 81651d4e4e8bbbbf6d88ded369552e346dd786953975111833dbec3553473b63

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for randomgen-1.19.0-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c8f954d743d8375006f33d18bfc2273645b92e5558734c49da1763f254df8e60
MD5 cd914f2d9587f07cc206165e0b9bcddd
BLAKE2b-256 11ef3c01519ceb0db9946d1da65aa586a18e60f14adb9e6551ee1f5e7c6aa39f

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