Change Log¶
v2.1.0¶
Fixed a bug in
LCG128Mix
that resulted ininc
not being correctly set when initialized without a user-providedinc
.Added the
Tyche
PRNG of Neves and Araujo. Supports two variants. One is the original implementation in the 2012 paper. The second implementation matches the version inOpenRand
.Added the
Squares
PRNG of Widynski. Supports two variants. The default uses 5 rounds of the middle square algorithm and outputs a 64-bit value. Ifvariant=32
, then 4 rounds are used but only 32 bits returned.Added the helper function
generate_keys()
forSquares
. This function can be used to pre-generate keys for use withSquares
.Refactored the broadcasting helper functions out of
randomgen.common
torandomgen.broadcast
. Tests have been added and some edge case bugs have been found and fixed.Improve test coverage.
Additional code clean-up.
v2.0.0¶
Final compatibility with NumPy 2
Minimum NumPy is now 1.22.3.
Removed
"legacy"
seeding in favor of usingSeedSequence
.Removed the vendored copy of
SeedSequence
.Deprecated using the
mode
keyword argument to set the seed mode, since onlySeedSequences
are supported.Changed
randomgen.common.BitGenerator
to inherit fromnumpy.random.BitGenerator
so that numpy will recognize these asBitGenerators
.Removed C distribution functions that are available in NumPy (see libnpyrandom)`.
General code cleanup and modernization.
v1.26.1¶
Initial compatability with Cython 3 and NumPy 2
v1.26.0¶
Fixed a bug that affected the
randomgen.xoroshiro128.Xoroshiro128.jumped()
method ofrandomgen.xoroshiro128.Xoroshiro128
where the ** version was swapped with the standard version.Fixed a bug where
numpy.random.SeedSequence
was not copied when advancing generators usingjumped
.Small compatibility fixes for change in NumPy.
Changes the documentation theme to sphinx-immaterial.
Added builds for Python 3.11.
Increased the minimum Python to 3.8.
v1.23.1¶
Registered the bit generators included in
randomgen
with NumPy so that NumPyGenerator
instances can be pickled and unpickled when using arandomstate
bit generator.Changed the canonical name of the bit generators to be their fully qualified name. For example,
PCG64
is not named"randomgen.pcg64.PCG64"
instead of"PCG64"
. This was done to avoid ambiguity with NumPy’s supplied bit generators with the same name.
v1.23.0¶
Removed
Generator
andRandomState
.
v1.20.2¶
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 toPCG64
,MT19937
,Philox
, andSFC64
. When using this mode, the sequence generated is guaranteed to match the sequence produced using the NumPy implementations as long as arandomgen.seed_sequence.SeedSequence
ornumpy.random.SeedSequence
is used with the same initial seed values.Added
random()
with support fordtype="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)
Out[4]:
array([0.66851489, 0.01769784, 0.87316102, 0.86532386, 0.85384162],
dtype=float128)
v1.20.1¶
Fixed a bug that affects
standard_gamma
when used without
and a Fortran contiguous array.Added
standard_wishart()
andwishart()
variate generators.
v1.20.0¶
Sync upstream changes from NumPy
Added typing information
Fixed a bug in
AESCounter
that prevented a small number of counter values from being directly set.
v1.19.3¶
Future proofed setup against
setuptools
anddistutils
changes.Enhanced documentation for
RDRAND
.
v1.19.2¶
Corrected
RDRAND
to retry on failures with pause between retries. Add a parameterretry
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 theRDRAND
docstring with unique considerations when usingRDRAND
that do not occur with deterministic PRNGs.
v1.19.1¶
Added
randomgen.romu.Romu
which is among the fastest available bit generators.Added
weyl_increments()
to simplify generating increments for use in parallel applications ofSFC64
.Completed * Quality Assurance of all bit generators to at least 4TB.
v1.19.0¶
Tested all bit generators out to at least 1TB using PractRand.
Added
randomgen.pcg64.PCG64DXSM
which is an alias forrandomgen.pcg64.PCG64
withvariant="dxsm"
andmode="sequence"
. This is the 2.0 version of PCG64 and will likely become the default bit generator in NumPy in the near future.Added
randomgen.efiix64.EFIIX64
which is both fast and high-quality.Added
randomgen.sfc.SFC64
which supports generating streams using distinct Weyl constants.Added a
randomgen.pcg64.LCG128Mix
which supports setting the LCG multiplier, changing the output function (including support for user-defined output functions) and pre- or post-state update generation.Added a
randomgen.lxm.LXM
which generates variates using a mix of two simple, but flawed generators: an Xorshift and a 64-bit LCG. This has been proposed for including in in Java.Added a
randomgen.wrapper.UserBitGenerator
which allows bit generators to be written in Python or numba.Added
randomgen.generator.ExtendedGenerator
which contains features not innumpy.random.Generator
.Added support for the
dxsm
anddxsm-128
variants ofrandomgen.pcg64.PCG64
. Thedxsm
variant is the official PCG 2.0 generator.Added support for broadcasting inputs in
randomgen.generator.ExtendedGenerator.multivariate_normal
.Added support for the ++ variant of
randomgen.xoroshiro128.Xoroshiro128
.Fixed a bug the produced incorrect results in
jumped()
.Fixed multiple bugs in
Generator
that were fixed innumpy.random.Generator
.
v1.18.0¶
choice
pulled in upstream performance improvement that use a hash set when choosing without replacement and without user-provided probabilities.Added support for
randomgen.seed_sequence.SeedSequence
(and NumPy’sSeedSequence
).Fixed a bug that affected both
randomgen.generator.Generator.randint
inGenerator
andrandint
inRandomState
whenhigh=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 inrandomgen.generator.Generator
is the value forhigh
is used. The fix restoresRandomState
to NumPy 1.16 compatibility. only affects the output ifdtype
is'int64'
This release brings many breaking changes. Most of these have been implemented using
DeprecationWarnings
. This has been done to bringrandomgen
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 raiseNotImplementedError
The internal structures that is used in C have been renamed. The main rename is
brng_t
tobitgen_t
The other key changes are:
Rename
RandomGenerator
toGenerator
.Rename
randint
tointegers
.Rename
random_integers
tointegers
.Rename
random_sample
torandom
.Change
jump
which operated in-place tojumped()
which returns a newBitGenerator
.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 toXoshiro512
v1.17.0¶
This release was skipped
v1.16.6¶
Changed the default jump step size to phi times the period of the generator for
PCG32
andPCG64
.Improved the performance of
PCG64
on Windows.Improves backward compatibility of
RandomState
v1.16.5¶
Fixed bugs in
laplace
,gumbel
,logseries
,normal
,standard_normal
,standard_exponential
,exponential
, andlogistic
that could result innan
values in rare circumstances (about 1 in \(10^{53}\) draws).Added keyword
closed
torandint
which changes sampling from the half-open interval[low, high)
to the closed interval[low, high]
.Fixed a bug in
random_integers
that could lead to valid values being treated as invalid.
v1.16.4¶
Add a fast path for broadcasting
randint
when usinguint64
orint64
.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)
v1.16.3¶
Release fixing Python 2.7 issues
v1.16.2¶
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 generatorsrandom_uintegers
, which can be replaced withrandint
.
Added
RandomState
as a clone of NumPy’s RandomState.Removed
LegacyGenerator
since this is no longer neededFixed many small bugs, including in cffi and ctype interfaces
v1.16.1¶
Synchronized with upstream changes.
Fixed a bug in gamma generation if the shape parameters is 0.0.
v1.16.0¶
Fixed a bug that affected
DSFMT
when callingjump()
orseed()
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
andXorshift1024
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.
v1.15.1¶
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.
v1.15¶
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