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

Uploaded Source

Built Distributions

randomgen-1.19.1-cp38-cp38-win_amd64.whl (6.0 MB view details)

Uploaded CPython 3.8 Windows x86-64

randomgen-1.19.1-cp38-cp38-win32.whl (5.8 MB view details)

Uploaded CPython 3.8 Windows x86

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

Uploaded CPython 3.8

randomgen-1.19.1-cp38-cp38-manylinux1_i686.whl (3.1 MB view details)

Uploaded CPython 3.8

randomgen-1.19.1-cp38-cp38-macosx_10_9_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

randomgen-1.19.1-cp37-cp37m-win_amd64.whl (6.0 MB view details)

Uploaded CPython 3.7m Windows x86-64

randomgen-1.19.1-cp37-cp37m-win32.whl (5.8 MB view details)

Uploaded CPython 3.7m Windows x86

randomgen-1.19.1-cp37-cp37m-manylinux1_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.7m

randomgen-1.19.1-cp37-cp37m-manylinux1_i686.whl (3.1 MB view details)

Uploaded CPython 3.7m

randomgen-1.19.1-cp37-cp37m-macosx_10_9_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

randomgen-1.19.1-cp36-cp36m-win_amd64.whl (6.0 MB view details)

Uploaded CPython 3.6m Windows x86-64

randomgen-1.19.1-cp36-cp36m-win32.whl (5.8 MB view details)

Uploaded CPython 3.6m Windows x86

randomgen-1.19.1-cp36-cp36m-manylinux1_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.6m

randomgen-1.19.1-cp36-cp36m-manylinux1_i686.whl (3.1 MB view details)

Uploaded CPython 3.6m

randomgen-1.19.1-cp36-cp36m-macosx_10_9_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.6m macOS 10.9+ x86-64

File details

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

File metadata

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

File hashes

Hashes for randomgen-1.19.1.tar.gz
Algorithm Hash digest
SHA256 34e532ac08ac065303b64824e2411570f26832626d38b5402b87b4e989332892
MD5 46f01b6dbdefdd600d973f9a30158402
BLAKE2b-256 46086d92b8c2dbe47640f3f61e168eb6766f5d2dc0b1306b63023f8f266347ef

See more details on using hashes here.

File details

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

File metadata

  • Download URL: randomgen-1.19.1-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 6.0 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.47.0 CPython/3.8.0

File hashes

Hashes for randomgen-1.19.1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 83b889d0d3a2a72f6442241547818c43a8c760b3d4e162f2c10bc91169d0758d
MD5 004a779a530abc1a1b59a3e8b9f8509c
BLAKE2b-256 812cb5b7ef8c0085692b452d67e472c7a21e28a9f0bbb0bf7aebb98f257d3a8b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: randomgen-1.19.1-cp38-cp38-win32.whl
  • Upload date:
  • Size: 5.8 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.47.0 CPython/3.8.0

File hashes

Hashes for randomgen-1.19.1-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 517caa5d61c7582b6c564839fdce2156ae777793cd51f50e8e13170ce6beafa8
MD5 e9dca8ca85aebcd48d48fb0c2efed5cd
BLAKE2b-256 a9a071446d4fbfc6226e78f0f83f0e2c6f7a50d5fe2a417be53a7909a7cc9f0a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: randomgen-1.19.1-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/47.3.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.6.7

File hashes

Hashes for randomgen-1.19.1-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 9093c949f8f4a454c2b8ddefdc3c122d854503b97d011337075b6fab3e1acfb8
MD5 847cb472cc22a69fc1b00f404c8d30c7
BLAKE2b-256 62d277ca6ae53898a04c413d732b9f6833c426bcdf82922e28734db03fd20922

See more details on using hashes here.

File details

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

File metadata

  • Download URL: randomgen-1.19.1-cp38-cp38-manylinux1_i686.whl
  • Upload date:
  • Size: 3.1 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/47.3.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.6.7

File hashes

Hashes for randomgen-1.19.1-cp38-cp38-manylinux1_i686.whl
Algorithm Hash digest
SHA256 49b2698a1692492963bdaa4ab95662df6a96111198c813b902c3bfbe7506fdd5
MD5 f4a4119abe5fc47c6d8739860a050eb4
BLAKE2b-256 ac9859265e31bcfc80107947db1076e4f83c92699f7bb89368c66549c7c3fe8d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: randomgen-1.19.1-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 3.2 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/47.3.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.6.8

File hashes

Hashes for randomgen-1.19.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 cf0f2902518c8a21f75cf98f58ca0fcf5d0276f0a888a477b94ade9b6759a592
MD5 beea0f62e4b01bd502871f9b62e22d16
BLAKE2b-256 10e6444dc26d2de61e5861dfc1ac8d79ed19a861563812a4d43f6d5c5b6f5c7e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: randomgen-1.19.1-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 6.0 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.47.0 CPython/3.7.5

File hashes

Hashes for randomgen-1.19.1-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 8cd6ccdf95f18303cdcfdcba9092dbf27ff1af274d0bb5fc751331fb55d78751
MD5 298dfd324961257eff1a1f3aaa8771ba
BLAKE2b-256 de9e070f5c67d14215b7cb0f409b13a3216c263fd996147146fd84dfe45d39ce

See more details on using hashes here.

File details

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

File metadata

  • Download URL: randomgen-1.19.1-cp37-cp37m-win32.whl
  • Upload date:
  • Size: 5.8 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.47.0 CPython/3.7.5

File hashes

Hashes for randomgen-1.19.1-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 b19dae3d610964f05416e153ad54c8f5bae3a84ed5a95ba067e6300937107a5d
MD5 1eff4c18f0a704dc179159ab5657d2cc
BLAKE2b-256 66fe93a84f1837450eb42f51ca56d6827de438bfc9cafb38d4ee3e59f1b00ee0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: randomgen-1.19.1-cp37-cp37m-manylinux1_x86_64.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/47.3.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.6.7

File hashes

Hashes for randomgen-1.19.1-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 6777640b51a517c95a057c0cab5c0e794e80a0ac38e95fd83942df2a0f745016
MD5 e71e541bd9524fbad6473020f4e5d0d8
BLAKE2b-256 471b2db60f42e037f7487f84173d27606ff4327ad8db3b5ac9bd1c2fcd963f01

See more details on using hashes here.

File details

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

File metadata

  • Download URL: randomgen-1.19.1-cp37-cp37m-manylinux1_i686.whl
  • Upload date:
  • Size: 3.1 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/47.3.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.6.7

File hashes

Hashes for randomgen-1.19.1-cp37-cp37m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 51a2aa12b8dabfb485a50f92badf69ba2c34932be4bdffa5c0fcb7c29751cd34
MD5 dfa424d4607175c74bc457bb1d12e33e
BLAKE2b-256 e00df7984d4684b2df697b37f5f235113ef8c1f6e344a1712589e36df6938e0d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: randomgen-1.19.1-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 3.2 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/47.3.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.6.8

File hashes

Hashes for randomgen-1.19.1-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ce24d23c4e9aeafce447b6ebbf50a0d08a364c24278bd284e5b460daf5a7d508
MD5 7507e864ae9fd96db1e9a3870fd39d29
BLAKE2b-256 16ff4138e04d7d7bb1e8020e2de16e685849680bc099f258aeb0e0fcfe0ba4ce

See more details on using hashes here.

File details

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

File metadata

  • Download URL: randomgen-1.19.1-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 6.0 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.47.0 CPython/3.6.8

File hashes

Hashes for randomgen-1.19.1-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 f9ad40f4dbd8855ceeed5c85430400e5d48627dbc87a5ecbf2f1179021e611a9
MD5 5122109266766b26e936eff96a44f553
BLAKE2b-256 0f77085d7e27a9321dde5ba0df6de412a2b0b708db91c22c518d7bfb67af79dc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: randomgen-1.19.1-cp36-cp36m-win32.whl
  • Upload date:
  • Size: 5.8 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.47.0 CPython/3.6.8

File hashes

Hashes for randomgen-1.19.1-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 49f15360d42a11555e690efe2f0d652d7d49222e71718781c75b7627eac60788
MD5 a5e0865f2b9015ed59689f2db8df1af4
BLAKE2b-256 eb9ae6d416e580536642b3659b32d60aedecb5b06f2611e40a06f5edd168b9df

See more details on using hashes here.

File details

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

File metadata

  • Download URL: randomgen-1.19.1-cp36-cp36m-manylinux1_x86_64.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/47.3.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.6.7

File hashes

Hashes for randomgen-1.19.1-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 ddf545d4d0167d5f91b845ed123dc450d56d139adac20c16a26c3cda8da4d10d
MD5 641fcc533f9ecaf7bb6cbb2d6d8b5d91
BLAKE2b-256 8909101f4f2afcfd754f0b5794eca407c727a0f33d43e95938c8e4e83cd0b4c0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: randomgen-1.19.1-cp36-cp36m-manylinux1_i686.whl
  • Upload date:
  • Size: 3.1 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/47.3.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.6.7

File hashes

Hashes for randomgen-1.19.1-cp36-cp36m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 18dd0a0aedf19c2d290e7771a4db71d4a631cf2233fe301346b18b2f379c91d8
MD5 c19b239b3167646c1ec9788c0e2fd4fb
BLAKE2b-256 1da765e6f64c9a2bcec6199fa0f001b27f09b8294a2b92dc66e9e18ad0cbdfc1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: randomgen-1.19.1-cp36-cp36m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 3.2 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/47.3.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.6.8

File hashes

Hashes for randomgen-1.19.1-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1dcbcd656b90006fbbd38aaa6e64abe1b74bffdae213920c5e142c0fe440d030
MD5 1eb4f54fba02341e62d3d54ac49a4042
BLAKE2b-256 4c426b39565db852ce6c9751bd07a4a5e81db0498027b7db315d59aab6e87bc0

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