Change Log


Generator and RandomState are DEPRECATED. You should be using numpy.random.Generator or numpy.random.RandomState which are better maintained. These will be maintained until after NumPy 1.21 (or 2 releases after NumPy 1.19) for users who cannot update NumPy.


  • Fixed a bug in SFC64 the used the wrong value from the Weyl sequence. In the original implementation, the current value is added to the next random integer and then incremented. The buggy version was incrementing then adding, and so was shifted by one value. This sequence should be similarly random in appearance, but it does not match the original specification and so has been changed.

  • Added mode="numpy" support to PCG64, MT19937, Philox, and SFC64. When using this mode, the sequence generated is guaranteed to match the sequence produced using the NumPy implementations as long as a SeedSequence or numpy.random.SeedSequence is used with the same initial seed values.

  • Added random() with support for dtype="longdouble" to produce extended precision random floats.

In [1]: import numpy as np

In [2]: from randomgen import ExtendedGenerator, PCG64

In [3]: eg = ExtendedGenerator(PCG64(20210501))

In [4]: eg.random(5, dtype=np.longdouble)
array([0.66851489, 0.01769784, 0.87316102, 0.86532386, 0.85384162],



  • Sync upstream changes from NumPy

  • Added typing information

  • Corrected a buffer access in ThreeFry and Philox.

  • Fixed a bug in AESCounter that prevented a small number of counter values from being directly set.


  • Future proofed setup against setuptools and distutils changes.

  • Enhanced documentation for RDRAND.


  • Corrected RDRAND to retry on failures with pause between retries. Add a parameter retry which allows the number of retries to be set. It defaults to the Intel recommended value of 10. Also sets an exception when the number of retries has been exhausted (very unlikely). See the RDRAND docstring with unique considerations when using RDRAND that do not occur with deterministic PRNGs.




  • choice() pulled in upstream performance improvement that use a hash set when choosing without replacement and without user-provided probabilities.

  • Added support for SeedSequence (and NumPy’s SeedSequence).

  • Fixed a bug that affected both randint in Generator and randint() in RandomState when high=2**32. This value is inbounds for a 32-bit unsigned closed interval generator, and so should have been redirected to a 32-bit generator. It was erroneously sent to the 64-bit path. The random values produced are fully random but inefficient. This fix breaks the stream in Generator is the value for ``high` is used. The fix restores RandomState to NumPy 1.16 compatibility. only affects the output if dtype is 'int64'

  • This release brings many breaking changes. Most of these have been implemented using DeprecationWarnings. This has been done to bring randomgen in-line with the API changes of the version going into NumPy.

  • Two changes that are more abrupt are:

    • The .generator method of the bit generators raise NotImplementedError

    • The internal structures that is used in C have been renamed. The main rename is brng_t to bitgen_t

  • The other key changes are:

    • Rename RandomGenerator to Generator.

    • Rename randint() to integers().

    • Rename random_integers() to integers().

    • Rename random_sample() to random().

    • Change jump which operated in-place to jumped() which returns a new BitGenerator.

    • Rename Basic RNG to bit generator, which has been consistently applied across the docs and references

  • Add the integer-based SIMD-based Fast Mersenne Twister (SFMT) generator SFMT.

  • Add the 64-bit Mersenne Twister (MT64) generator MT64.

  • Renamed Xoshiro256StarStar to Xoshiro256 and Xoshiro512StarStar to Xoshiro512


  • This release was skipped


  • Changed the default jump step size to phi times the period of the generator for PCG32 and PCG64.

  • Improved the performance of PCG64 on Windows.

  • Improved performance of jump() and jumped().

  • Improves backward compatibility of RandomState



  • Add a fast path for broadcasting randint() when using uint64 or int64.

  • Refactor PCG64 so that it does not rely on Cython conditional compilation.

  • Add brng() to access the basic RNG.

  • Allow multidimensional arrays in choice().

  • Speed-up choice() when not replacing. The gains can be very large (1000x or more) when the input array is large but the sample size is small.

  • Add parameter checks in multinomial().

  • Fix an edge-case bug in zipf().

  • Allow 0 for sample in hypergeometric().

  • Add broadcasting to multinomial() (see NumPy issue 9710)


  • Release fixing Python 2.7 issues


  • Updated Xoroshiro120 to use Author’s latest parametrization

  • Closely synchronized with the version of randomgen being integrated into NumPy, including removing:

    • random_raw, which have been moved to the individual bit generators

    • random_uintegers, which can be replaced with randint().

  • Added RandomState as a clone of NumPy’s RandomState.

  • Removed LegacyGenerator since this is no longer needed

  • Fixed many small bugs, including in cffi and ctype interfaces


  • Synchronized with upstream changes.

  • Fixed a bug in gamma generation if the shape parameters is 0.0.


  • Fixed a bug that affected DSFMT when calling jump() or seed() that failed to reset the buffer. This resulted in up to 381 values from the previous state being used before the buffer was refilled at the new state.

  • Fixed bugs in Xoshiro512 and Xorshift1024 where the fallback entropy initialization used too few bytes. This bug is unlikely to be encountered since this path is only encountered if the system random number generator fails.

  • Synchronized with upstream changes.


  • Added Xoshiro256** and Xoshiro512**, the preferred generators of this class.

  • Fixed bug in jump method of Random123 generators which did not specify a default value.

  • Added support for generating bounded uniform integers using Lemire’s method.

  • Synchronized with upstream changes, which requires moving the minimum supported NumPy to 1.13.


  • Synced empty choice changes

  • Synced upstream docstring changes

  • Synced upstream changes in permutation

  • Synced upstream doc fixes

  • Added absolute_import to avoid import noise on Python 2.7

  • Add legacy generator which allows NumPy replication

  • Improve type handling of integers

  • Switch to array-fillers for 0 parameter distribution to improve performance

  • Small changes to build on manylinux

  • Build wheels using multibuild