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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.8 Windows x86-64

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

Uploaded CPython 3.8 Windows x86

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

Uploaded CPython 3.8

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

Uploaded CPython 3.8

randomgen-1.19.2-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.2-cp37-cp37m-win_amd64.whl (6.1 MB view details)

Uploaded CPython 3.7m Windows x86-64

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

Uploaded CPython 3.7m Windows x86

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

Uploaded CPython 3.7m

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

Uploaded CPython 3.7m

randomgen-1.19.2-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.2-cp36-cp36m-win_amd64.whl (6.1 MB view details)

Uploaded CPython 3.6m Windows x86-64

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

Uploaded CPython 3.6m Windows x86

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

Uploaded CPython 3.6m

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

Uploaded CPython 3.6m

randomgen-1.19.2-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.2.tar.gz.

File metadata

  • Download URL: randomgen-1.19.2.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/47.3.1.post20200622 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.7

File hashes

Hashes for randomgen-1.19.2.tar.gz
Algorithm Hash digest
SHA256 8c69d5c5657d661ebc7e81f345b8a30e9ff3f939ecf0c566ad6512e36f0ccdae
MD5 e0d8fa1f0ec80b0f16333a03eec01129
BLAKE2b-256 894610489286e51e90820a1c2625c8589fc65671159b80980c7b06f76b40408f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: randomgen-1.19.2-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.47.0 CPython/3.8.0

File hashes

Hashes for randomgen-1.19.2-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 9b3f52ab6ef142af9f8b566db164928df2eb665d1ee5e0f775cca2939c7c5518
MD5 23c08f5d9c89ae27bce1ce0f3edbcf41
BLAKE2b-256 b504b0a680782206b7d1d9aea8ca1b7ba3e15bdbfbce9749bb97af8f7358e892

See more details on using hashes here.

File details

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

File metadata

  • Download URL: randomgen-1.19.2-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.47.0 CPython/3.8.0

File hashes

Hashes for randomgen-1.19.2-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 20054cd2f34396bb64bc29afd99dbb9d0984a102663c90d4a10be1322490fed2
MD5 400a80aa7987fed7192a9781b64aedb4
BLAKE2b-256 304f4d7fe592106e64de87363ef095a71efc93ce12fe1f1674530bb3344eb6ca

See more details on using hashes here.

File details

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

File metadata

  • Download URL: randomgen-1.19.2-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.47.0 CPython/3.6.7

File hashes

Hashes for randomgen-1.19.2-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 c6ebf94cca0f14eab32fdc15b91822b8a1835502baee99af1f260be7b3bd41e6
MD5 b5342bcf2394b01812f2f5c9cc2f60a6
BLAKE2b-256 f9694e4f9d9c99a86e4e0e9d63403e91c410c2b6f4cefb43144d23703f5c583e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: randomgen-1.19.2-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.47.0 CPython/3.6.7

File hashes

Hashes for randomgen-1.19.2-cp38-cp38-manylinux1_i686.whl
Algorithm Hash digest
SHA256 38308d61b8d4e2577f0a98e0a5fc2a5b37ad0de0b971417ac68ced0730e1aeec
MD5 3a249f3f83590ea101a9dfa80be4c133
BLAKE2b-256 68f21ce503c01174a79bffd1dcdaa3ffe82361ea6a4febc40d78b7a084505ed3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: randomgen-1.19.2-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.1.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.6.8

File hashes

Hashes for randomgen-1.19.2-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 68955cc6098bf68efe9ea05e801f9bdacca6315e84a73fd440d8f11ffc81108a
MD5 c64c5a153dc7890e43ac67cc3439f445
BLAKE2b-256 5bd502e3b280ee2ce3a8a7b24ab020bbd25fa8dcda677aeeafda34b248ec0ff9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: randomgen-1.19.2-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.47.0 CPython/3.7.5

File hashes

Hashes for randomgen-1.19.2-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 b6d1e11217f204ddf78cbea93a9bd0a112efb1487c10cfb6275989f87920bcab
MD5 f7c7327406ef862ef418316bbe841c5b
BLAKE2b-256 c9002a0db3ccd04f231524c7ddca584597039ccc46d9d4fd3fb1605ff443d294

See more details on using hashes here.

File details

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

File metadata

  • Download URL: randomgen-1.19.2-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.47.0 CPython/3.7.5

File hashes

Hashes for randomgen-1.19.2-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 55f51a57b26b6a56cf94116fab8fcc01e37f250f3518a60d5c0a36dba31713a1
MD5 40363d4afde316ac3688c5597bb67653
BLAKE2b-256 f81830e18b5c1d081c5e4d2957640be92f8b1da3b9965970fce1683879005da6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: randomgen-1.19.2-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.47.0 CPython/3.6.7

File hashes

Hashes for randomgen-1.19.2-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 180d35ab6ed5b15d10dafd03b06e782ed650324c00b9620e2e3d06538484b5c0
MD5 b8b00a1d007913ed7f38254853fee886
BLAKE2b-256 55e0a155447e7bb7f4ed4868ed4d0bbe42ac600064a36ce2a91218ecc8733a04

See more details on using hashes here.

File details

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

File metadata

  • Download URL: randomgen-1.19.2-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.47.0 CPython/3.6.7

File hashes

Hashes for randomgen-1.19.2-cp37-cp37m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 95bac3cf4f309a1549f399ea419a1893dea78707e4b669a666dadc514f33d030
MD5 b5e2a05522c0032ed2da6f6fcacb16a3
BLAKE2b-256 d1799327e595c76344e89176791bb995304df523f99df3d4e7d5cddd65dd8df9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: randomgen-1.19.2-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.1.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.6.8

File hashes

Hashes for randomgen-1.19.2-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 def3c4b1b2101d65f2beda5ad357793b51d0fbcccbb5c708299addc0fd7abf02
MD5 8598568c32e921ab67c3230479d4ad92
BLAKE2b-256 7f540a99f699e508994f0cf4955a26ded23a98f8d43e8ffd2e6e4ce7aeb9670d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: randomgen-1.19.2-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.47.0 CPython/3.6.8

File hashes

Hashes for randomgen-1.19.2-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 f8f2880a71963164d55a8fdf8b46b5745720c54633c8e7098de365b7aecdd589
MD5 3f2b9e2fa5f211190923b535de9b41b3
BLAKE2b-256 eb76b90699dfaf7d58bf9c0b9cf685730e32fa97bee0ea4346713b5bc46c6f52

See more details on using hashes here.

File details

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

File metadata

  • Download URL: randomgen-1.19.2-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.47.0 CPython/3.6.8

File hashes

Hashes for randomgen-1.19.2-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 2f5e2d4bb0b7265971acefbd7e537cfddb130bea8a515f38c5901c4138b8fba5
MD5 a4ffb77db71eededdc48920b0de8dc01
BLAKE2b-256 175b354a7e19f8d781b4c2b36b18475231a07ff09d07fe9fe5386d47b9c4959d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: randomgen-1.19.2-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.47.0 CPython/3.6.7

File hashes

Hashes for randomgen-1.19.2-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 fb80404b16ab4809ebf58206db75730e1be9d793626e1850cd9e2a6cd12b5f0d
MD5 1e336d5473a28e1318bfe99c65188e67
BLAKE2b-256 854b9204451db6beedc8b6c2565fcc512450ac72976cbbd0fb07588a32bd5889

See more details on using hashes here.

File details

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

File metadata

  • Download URL: randomgen-1.19.2-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.47.0 CPython/3.6.7

File hashes

Hashes for randomgen-1.19.2-cp36-cp36m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 025f2c72b3325e86beeb6e9586c980f87ffd68bad554ce0257e5e3f7ee57e0d4
MD5 44d9bdf50f72f96b5b31ea3457e3ba5d
BLAKE2b-256 4c276850c78c1a7a7b060b21671cde0f1dd6c54ee1cef849b80e623b6e21ff09

See more details on using hashes here.

File details

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

File metadata

  • Download URL: randomgen-1.19.2-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.1.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.6.8

File hashes

Hashes for randomgen-1.19.2-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 aca796e831fd3922b7097a24e367daaa51b5abe65fa51fc58ff97ffdcdfff25d
MD5 cbae0dbe7a87435c193a97ecd936bc51
BLAKE2b-256 d45ad812ef5fac55aac24473eb79fa75833e43b5bb16a162e38165f162830752

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