summaryrefslogtreecommitdiff
path: root/numpy/random
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/random')
-rw-r--r--numpy/random/LICENSE.md (renamed from numpy/random/randomgen/LICENSE.md)0
-rw-r--r--numpy/random/__init__.py36
-rw-r--r--numpy/random/_mtrand/Python.pxi (renamed from numpy/random/mtrand/Python.pxi)0
-rw-r--r--numpy/random/_mtrand/distributions.c (renamed from numpy/random/mtrand/distributions.c)0
-rw-r--r--numpy/random/_mtrand/distributions.h (renamed from numpy/random/mtrand/distributions.h)0
-rw-r--r--numpy/random/_mtrand/generate_mtrand_c.py42
-rw-r--r--numpy/random/_mtrand/initarray.c (renamed from numpy/random/mtrand/initarray.c)0
-rw-r--r--numpy/random/_mtrand/initarray.h (renamed from numpy/random/mtrand/initarray.h)0
-rw-r--r--numpy/random/_mtrand/mtrand.pyx (renamed from numpy/random/mtrand/mtrand.pyx)0
-rw-r--r--numpy/random/_mtrand/mtrand_py_helper.h (renamed from numpy/random/mtrand/mtrand_py_helper.h)0
-rw-r--r--numpy/random/_mtrand/numpy.pxd (renamed from numpy/random/mtrand/numpy.pxd)0
-rw-r--r--numpy/random/_mtrand/randint_helpers.pxi.in (renamed from numpy/random/mtrand/randint_helpers.pxi.in)0
-rw-r--r--numpy/random/_mtrand/randomkit.c (renamed from numpy/random/mtrand/randomkit.c)0
-rw-r--r--numpy/random/_mtrand/randomkit.h (renamed from numpy/random/mtrand/randomkit.h)0
-rw-r--r--numpy/random/_pickle.py (renamed from numpy/random/randomgen/_pickle.py)0
-rw-r--r--numpy/random/bounded_integers.pxd.in (renamed from numpy/random/randomgen/bounded_integers.pxd.in)0
-rw-r--r--numpy/random/bounded_integers.pyx.in (renamed from numpy/random/randomgen/bounded_integers.pyx.in)0
-rw-r--r--numpy/random/common.pxd (renamed from numpy/random/randomgen/common.pxd)0
-rw-r--r--numpy/random/common.pyx (renamed from numpy/random/randomgen/common.pyx)0
-rw-r--r--numpy/random/distributions.pxd (renamed from numpy/random/randomgen/distributions.pxd)0
-rw-r--r--numpy/random/dsfmt.pyx (renamed from numpy/random/randomgen/dsfmt.pyx)0
-rw-r--r--numpy/random/entropy.pyx (renamed from numpy/random/randomgen/entropy.pyx)0
-rw-r--r--numpy/random/examples/cython/extending.pyx (renamed from numpy/random/randomgen/examples/cython/extending.pyx)0
-rw-r--r--numpy/random/examples/cython/extending_distributions.pyx (renamed from numpy/random/randomgen/examples/cython/extending_distributions.pyx)0
-rw-r--r--numpy/random/examples/cython/setup.py (renamed from numpy/random/randomgen/examples/cython/setup.py)0
-rw-r--r--numpy/random/examples/numba/extending.py (renamed from numpy/random/randomgen/examples/numba/extending.py)0
-rw-r--r--numpy/random/examples/numba/extending_distributions.py (renamed from numpy/random/randomgen/examples/numba/extending_distributions.py)0
-rw-r--r--numpy/random/generator.pyx (renamed from numpy/random/randomgen/generator.pyx)74
-rw-r--r--numpy/random/legacy/__init__.py (renamed from numpy/random/randomgen/legacy/__init__.py)0
-rw-r--r--numpy/random/legacy/legacy_distributions.pxd (renamed from numpy/random/randomgen/legacy/legacy_distributions.pxd)0
-rw-r--r--numpy/random/mt19937.pyx (renamed from numpy/random/randomgen/mt19937.pyx)0
-rw-r--r--numpy/random/mtrand.pyx (renamed from numpy/random/randomgen/mtrand.pyx)0
-rw-r--r--numpy/random/pcg32.pyx (renamed from numpy/random/randomgen/pcg32.pyx)0
-rw-r--r--numpy/random/pcg64.pyx (renamed from numpy/random/randomgen/pcg64.pyx)0
-rw-r--r--numpy/random/philox.pyx (renamed from numpy/random/randomgen/philox.pyx)0
-rw-r--r--numpy/random/randomgen/__init__.py21
-rw-r--r--numpy/random/randomgen/_version.py520
-rw-r--r--numpy/random/randomgen/setup.py191
-rw-r--r--numpy/random/randomgen/tests/data/__init__.py0
-rw-r--r--numpy/random/setup.py153
-rw-r--r--numpy/random/src/aligned_malloc/aligned_malloc.c (renamed from numpy/random/randomgen/src/aligned_malloc/aligned_malloc.c)0
-rw-r--r--numpy/random/src/aligned_malloc/aligned_malloc.h (renamed from numpy/random/randomgen/src/aligned_malloc/aligned_malloc.h)0
-rw-r--r--numpy/random/src/common/LICENSE.md (renamed from numpy/random/randomgen/src/common/LICENSE.md)0
-rw-r--r--numpy/random/src/common/inttypes.h (renamed from numpy/random/randomgen/src/common/inttypes.h)0
-rw-r--r--numpy/random/src/common/stdint.h (renamed from numpy/random/randomgen/src/common/stdint.h)0
-rw-r--r--numpy/random/src/distributions/LICENSE.md (renamed from numpy/random/randomgen/src/distributions/LICENSE.md)0
-rw-r--r--numpy/random/src/distributions/binomial.h (renamed from numpy/random/randomgen/src/distributions/binomial.h)0
-rw-r--r--numpy/random/src/distributions/distributions.c (renamed from numpy/random/randomgen/src/distributions/distributions.c)0
-rw-r--r--numpy/random/src/distributions/distributions.h (renamed from numpy/random/randomgen/src/distributions/distributions.h)0
-rw-r--r--numpy/random/src/distributions/ziggurat.h (renamed from numpy/random/randomgen/src/distributions/ziggurat.h)0
-rw-r--r--numpy/random/src/distributions/ziggurat_constants.h (renamed from numpy/random/randomgen/src/distributions/ziggurat_constants.h)0
-rw-r--r--numpy/random/src/dsfmt/128-bit-jump.poly.txt (renamed from numpy/random/randomgen/src/dsfmt/128-bit-jump.poly.txt)0
-rw-r--r--numpy/random/src/dsfmt/96-bit-jump.poly.txt (renamed from numpy/random/randomgen/src/dsfmt/96-bit-jump.poly.txt)0
-rw-r--r--numpy/random/src/dsfmt/LICENSE.md (renamed from numpy/random/randomgen/src/dsfmt/LICENSE.md)0
-rw-r--r--numpy/random/src/dsfmt/calc-jump.cpp (renamed from numpy/random/randomgen/src/dsfmt/calc-jump.cpp)0
-rw-r--r--numpy/random/src/dsfmt/dSFMT-benchmark.c (renamed from numpy/random/randomgen/src/dsfmt/dSFMT-benchmark.c)0
-rw-r--r--numpy/random/src/dsfmt/dSFMT-calc-jump.hpp (renamed from numpy/random/randomgen/src/dsfmt/dSFMT-calc-jump.hpp)0
-rw-r--r--numpy/random/src/dsfmt/dSFMT-common.h (renamed from numpy/random/randomgen/src/dsfmt/dSFMT-common.h)0
-rw-r--r--numpy/random/src/dsfmt/dSFMT-jump.c (renamed from numpy/random/randomgen/src/dsfmt/dSFMT-jump.c)0
-rw-r--r--numpy/random/src/dsfmt/dSFMT-jump.h (renamed from numpy/random/randomgen/src/dsfmt/dSFMT-jump.h)0
-rw-r--r--numpy/random/src/dsfmt/dSFMT-params.h (renamed from numpy/random/randomgen/src/dsfmt/dSFMT-params.h)0
-rw-r--r--numpy/random/src/dsfmt/dSFMT-params19937.h (renamed from numpy/random/randomgen/src/dsfmt/dSFMT-params19937.h)0
-rw-r--r--numpy/random/src/dsfmt/dSFMT-poly.h (renamed from numpy/random/randomgen/src/dsfmt/dSFMT-poly.h)0
-rw-r--r--numpy/random/src/dsfmt/dSFMT-test-gen.c (renamed from numpy/random/randomgen/src/dsfmt/dSFMT-test-gen.c)0
-rw-r--r--numpy/random/src/dsfmt/dSFMT.c (renamed from numpy/random/randomgen/src/dsfmt/dSFMT.c)0
-rw-r--r--numpy/random/src/dsfmt/dSFMT.h (renamed from numpy/random/randomgen/src/dsfmt/dSFMT.h)0
-rw-r--r--numpy/random/src/entropy/LICENSE.md (renamed from numpy/random/randomgen/src/entropy/LICENSE.md)0
-rw-r--r--numpy/random/src/entropy/entropy.c (renamed from numpy/random/randomgen/src/entropy/entropy.c)0
-rw-r--r--numpy/random/src/entropy/entropy.h (renamed from numpy/random/randomgen/src/entropy/entropy.h)0
-rw-r--r--numpy/random/src/legacy/LICENSE.md (renamed from numpy/random/randomgen/src/legacy/LICENSE.md)0
-rw-r--r--numpy/random/src/legacy/distributions-boxmuller.c (renamed from numpy/random/randomgen/src/legacy/distributions-boxmuller.c)0
-rw-r--r--numpy/random/src/legacy/distributions-boxmuller.h (renamed from numpy/random/randomgen/src/legacy/distributions-boxmuller.h)0
-rw-r--r--numpy/random/src/mt19937/LICENSE.md (renamed from numpy/random/randomgen/src/mt19937/LICENSE.md)0
-rw-r--r--numpy/random/src/mt19937/mt19937-benchmark.c (renamed from numpy/random/randomgen/src/mt19937/mt19937-benchmark.c)0
-rw-r--r--numpy/random/src/mt19937/mt19937-jump.c (renamed from numpy/random/randomgen/src/mt19937/mt19937-jump.c)0
-rw-r--r--numpy/random/src/mt19937/mt19937-jump.h (renamed from numpy/random/randomgen/src/mt19937/mt19937-jump.h)0
-rw-r--r--numpy/random/src/mt19937/mt19937-poly.h (renamed from numpy/random/randomgen/src/mt19937/mt19937-poly.h)0
-rw-r--r--numpy/random/src/mt19937/mt19937-test-data-gen.c (renamed from numpy/random/randomgen/src/mt19937/mt19937-test-data-gen.c)0
-rw-r--r--numpy/random/src/mt19937/mt19937.c (renamed from numpy/random/randomgen/src/mt19937/mt19937.c)0
-rw-r--r--numpy/random/src/mt19937/mt19937.h (renamed from numpy/random/randomgen/src/mt19937/mt19937.h)0
-rw-r--r--numpy/random/src/mt19937/randomkit.c (renamed from numpy/random/randomgen/src/mt19937/randomkit.c)0
-rw-r--r--numpy/random/src/mt19937/randomkit.h (renamed from numpy/random/randomgen/src/mt19937/randomkit.h)0
-rw-r--r--numpy/random/src/pcg32/LICENSE.md (renamed from numpy/random/randomgen/src/pcg32/LICENSE.md)0
-rw-r--r--numpy/random/src/pcg32/pcg-advance-64.c (renamed from numpy/random/randomgen/src/pcg32/pcg-advance-64.c)0
-rw-r--r--numpy/random/src/pcg32/pcg32-test-data-gen.c (renamed from numpy/random/randomgen/src/pcg32/pcg32-test-data-gen.c)0
-rw-r--r--numpy/random/src/pcg32/pcg32.c (renamed from numpy/random/randomgen/src/pcg32/pcg32.c)0
-rw-r--r--numpy/random/src/pcg32/pcg32.h (renamed from numpy/random/randomgen/src/pcg32/pcg32.h)0
-rw-r--r--numpy/random/src/pcg32/pcg_variants.h (renamed from numpy/random/randomgen/src/pcg32/pcg_variants.h)0
-rw-r--r--numpy/random/src/pcg64/LICENSE.md (renamed from numpy/random/randomgen/src/pcg64/LICENSE.md)0
-rw-r--r--numpy/random/src/pcg64/pcg64-benchmark.c (renamed from numpy/random/randomgen/src/pcg64/pcg64-benchmark.c)0
-rw-r--r--numpy/random/src/pcg64/pcg64-test-data-gen.c (renamed from numpy/random/randomgen/src/pcg64/pcg64-test-data-gen.c)0
-rw-r--r--numpy/random/src/pcg64/pcg64.c (renamed from numpy/random/randomgen/src/pcg64/pcg64.c)0
-rw-r--r--numpy/random/src/pcg64/pcg64.h (renamed from numpy/random/randomgen/src/pcg64/pcg64.h)0
-rw-r--r--numpy/random/src/pcg64/pcg64.orig.c (renamed from numpy/random/randomgen/src/pcg64/pcg64.orig.c)0
-rw-r--r--numpy/random/src/pcg64/pcg64.orig.h (renamed from numpy/random/randomgen/src/pcg64/pcg64.orig.h)0
-rw-r--r--numpy/random/src/philox/LICENSE.md (renamed from numpy/random/randomgen/src/philox/LICENSE.md)0
-rw-r--r--numpy/random/src/philox/philox-benchmark.c (renamed from numpy/random/randomgen/src/philox/philox-benchmark.c)0
-rw-r--r--numpy/random/src/philox/philox-test-data-gen.c (renamed from numpy/random/randomgen/src/philox/philox-test-data-gen.c)0
-rw-r--r--numpy/random/src/philox/philox.c (renamed from numpy/random/randomgen/src/philox/philox.c)0
-rw-r--r--numpy/random/src/philox/philox.h (renamed from numpy/random/randomgen/src/philox/philox.h)0
-rw-r--r--numpy/random/src/splitmix64/LICENSE.md (renamed from numpy/random/randomgen/src/splitmix64/LICENSE.md)0
-rw-r--r--numpy/random/src/splitmix64/splitmix64.c (renamed from numpy/random/randomgen/src/splitmix64/splitmix64.c)0
-rw-r--r--numpy/random/src/splitmix64/splitmix64.h (renamed from numpy/random/randomgen/src/splitmix64/splitmix64.h)0
-rw-r--r--numpy/random/src/splitmix64/splitmix64.orig.c (renamed from numpy/random/randomgen/src/splitmix64/splitmix64.orig.c)0
-rw-r--r--numpy/random/src/threefry/LICENSE.md (renamed from numpy/random/randomgen/src/threefry/LICENSE.md)0
-rw-r--r--numpy/random/src/threefry/threefry-benchmark.c (renamed from numpy/random/randomgen/src/threefry/threefry-benchmark.c)0
-rw-r--r--numpy/random/src/threefry/threefry-orig.c (renamed from numpy/random/randomgen/src/threefry/threefry-orig.c)0
-rw-r--r--numpy/random/src/threefry/threefry-test-data-gen.c (renamed from numpy/random/randomgen/src/threefry/threefry-test-data-gen.c)0
-rw-r--r--numpy/random/src/threefry/threefry.c (renamed from numpy/random/randomgen/src/threefry/threefry.c)0
-rw-r--r--numpy/random/src/threefry/threefry.h (renamed from numpy/random/randomgen/src/threefry/threefry.h)0
-rw-r--r--numpy/random/src/threefry32/LICENSE.md (renamed from numpy/random/randomgen/src/threefry32/LICENSE.md)0
-rw-r--r--numpy/random/src/threefry32/threefry32-test-data-gen.c (renamed from numpy/random/randomgen/src/threefry32/threefry32-test-data-gen.c)0
-rw-r--r--numpy/random/src/threefry32/threefry32.c (renamed from numpy/random/randomgen/src/threefry32/threefry32.c)0
-rw-r--r--numpy/random/src/threefry32/threefry32.h (renamed from numpy/random/randomgen/src/threefry32/threefry32.h)0
-rw-r--r--numpy/random/src/xoroshiro128/LICENSE.md (renamed from numpy/random/randomgen/src/xoroshiro128/LICENSE.md)0
-rw-r--r--numpy/random/src/xoroshiro128/xoroshiro128-benchmark.c (renamed from numpy/random/randomgen/src/xoroshiro128/xoroshiro128-benchmark.c)0
-rw-r--r--numpy/random/src/xoroshiro128/xoroshiro128-test-data-gen.c (renamed from numpy/random/randomgen/src/xoroshiro128/xoroshiro128-test-data-gen.c)0
-rw-r--r--numpy/random/src/xoroshiro128/xoroshiro128.c (renamed from numpy/random/randomgen/src/xoroshiro128/xoroshiro128.c)0
-rw-r--r--numpy/random/src/xoroshiro128/xoroshiro128.h (renamed from numpy/random/randomgen/src/xoroshiro128/xoroshiro128.h)0
-rw-r--r--numpy/random/src/xoroshiro128/xoroshiro128plus.orig.c (renamed from numpy/random/randomgen/src/xoroshiro128/xoroshiro128plus.orig.c)0
-rw-r--r--numpy/random/src/xoroshiro128/xoroshiro128plus.orig.h (renamed from numpy/random/randomgen/src/xoroshiro128/xoroshiro128plus.orig.h)0
-rw-r--r--numpy/random/src/xorshift1024/LICENSE.md (renamed from numpy/random/randomgen/src/xorshift1024/LICENSE.md)0
-rw-r--r--numpy/random/src/xorshift1024/xorshift1024-benchmark.c (renamed from numpy/random/randomgen/src/xorshift1024/xorshift1024-benchmark.c)0
-rw-r--r--numpy/random/src/xorshift1024/xorshift1024-test-data-gen.c (renamed from numpy/random/randomgen/src/xorshift1024/xorshift1024-test-data-gen.c)0
-rw-r--r--numpy/random/src/xorshift1024/xorshift1024.c (renamed from numpy/random/randomgen/src/xorshift1024/xorshift1024.c)0
-rw-r--r--numpy/random/src/xorshift1024/xorshift1024.h (renamed from numpy/random/randomgen/src/xorshift1024/xorshift1024.h)0
-rw-r--r--numpy/random/src/xorshift1024/xorshift1024.orig.c (renamed from numpy/random/randomgen/src/xorshift1024/xorshift1024.orig.c)0
-rw-r--r--numpy/random/src/xorshift1024/xorshift1024.orig.h (renamed from numpy/random/randomgen/src/xorshift1024/xorshift1024.orig.h)0
-rw-r--r--numpy/random/src/xoshiro256starstar/LICENSE.md (renamed from numpy/random/randomgen/src/xoshiro256starstar/LICENSE.md)0
-rw-r--r--numpy/random/src/xoshiro256starstar/xoshiro256starstar-test-data-gen.c (renamed from numpy/random/randomgen/src/xoshiro256starstar/xoshiro256starstar-test-data-gen.c)0
-rw-r--r--numpy/random/src/xoshiro256starstar/xoshiro256starstar.c (renamed from numpy/random/randomgen/src/xoshiro256starstar/xoshiro256starstar.c)0
-rw-r--r--numpy/random/src/xoshiro256starstar/xoshiro256starstar.h (renamed from numpy/random/randomgen/src/xoshiro256starstar/xoshiro256starstar.h)0
-rw-r--r--numpy/random/src/xoshiro256starstar/xoshiro256starstar.orig.c (renamed from numpy/random/randomgen/src/xoshiro256starstar/xoshiro256starstar.orig.c)0
-rw-r--r--numpy/random/src/xoshiro256starstar/xoshiro256starstar.orig.h (renamed from numpy/random/randomgen/src/xoshiro256starstar/xoshiro256starstar.orig.h)0
-rw-r--r--numpy/random/src/xoshiro512starstar/LICENSE.md (renamed from numpy/random/randomgen/src/xoshiro512starstar/LICENSE.md)0
-rw-r--r--numpy/random/src/xoshiro512starstar/xoshiro512starstar-test-data-gen.c (renamed from numpy/random/randomgen/src/xoshiro512starstar/xoshiro512starstar-test-data-gen.c)0
-rw-r--r--numpy/random/src/xoshiro512starstar/xoshiro512starstar.c (renamed from numpy/random/randomgen/src/xoshiro512starstar/xoshiro512starstar.c)0
-rw-r--r--numpy/random/src/xoshiro512starstar/xoshiro512starstar.h (renamed from numpy/random/randomgen/src/xoshiro512starstar/xoshiro512starstar.h)0
-rw-r--r--numpy/random/src/xoshiro512starstar/xoshiro512starstar.orig.c (renamed from numpy/random/randomgen/src/xoshiro512starstar/xoshiro512starstar.orig.c)0
-rw-r--r--numpy/random/src/xoshiro512starstar/xoshiro512starstar.orig.h (renamed from numpy/random/randomgen/src/xoshiro512starstar/xoshiro512starstar.orig.h)0
-rw-r--r--numpy/random/tests/data/__init__.py (renamed from numpy/random/randomgen/tests/__init__.py)0
-rw-r--r--numpy/random/tests/data/dSFMT-testset-1.csv (renamed from numpy/random/randomgen/tests/data/dSFMT-testset-1.csv)0
-rw-r--r--numpy/random/tests/data/dSFMT-testset-2.csv (renamed from numpy/random/randomgen/tests/data/dSFMT-testset-2.csv)0
-rw-r--r--numpy/random/tests/data/mt19937-testset-1.csv (renamed from numpy/random/randomgen/tests/data/mt19937-testset-1.csv)0
-rw-r--r--numpy/random/tests/data/mt19937-testset-2.csv (renamed from numpy/random/randomgen/tests/data/mt19937-testset-2.csv)0
-rw-r--r--numpy/random/tests/data/pcg32-testset-1.csv (renamed from numpy/random/randomgen/tests/data/pcg32-testset-1.csv)0
-rw-r--r--numpy/random/tests/data/pcg32-testset-2.csv (renamed from numpy/random/randomgen/tests/data/pcg32-testset-2.csv)0
-rw-r--r--numpy/random/tests/data/pcg64-testset-1.csv (renamed from numpy/random/randomgen/tests/data/pcg64-testset-1.csv)0
-rw-r--r--numpy/random/tests/data/pcg64-testset-2.csv (renamed from numpy/random/randomgen/tests/data/pcg64-testset-2.csv)0
-rw-r--r--numpy/random/tests/data/philox-testset-1.csv (renamed from numpy/random/randomgen/tests/data/philox-testset-1.csv)0
-rw-r--r--numpy/random/tests/data/philox-testset-2.csv (renamed from numpy/random/randomgen/tests/data/philox-testset-2.csv)0
-rw-r--r--numpy/random/tests/data/threefry-testset-1.csv (renamed from numpy/random/randomgen/tests/data/threefry-testset-1.csv)0
-rw-r--r--numpy/random/tests/data/threefry-testset-2.csv (renamed from numpy/random/randomgen/tests/data/threefry-testset-2.csv)0
-rw-r--r--numpy/random/tests/data/threefry32-testset-1.csv (renamed from numpy/random/randomgen/tests/data/threefry32-testset-1.csv)0
-rw-r--r--numpy/random/tests/data/threefry32-testset-2.csv (renamed from numpy/random/randomgen/tests/data/threefry32-testset-2.csv)0
-rw-r--r--numpy/random/tests/data/xoroshiro128-testset-1.csv (renamed from numpy/random/randomgen/tests/data/xoroshiro128-testset-1.csv)0
-rw-r--r--numpy/random/tests/data/xoroshiro128-testset-2.csv (renamed from numpy/random/randomgen/tests/data/xoroshiro128-testset-2.csv)0
-rw-r--r--numpy/random/tests/data/xorshift1024-testset-1.csv (renamed from numpy/random/randomgen/tests/data/xorshift1024-testset-1.csv)0
-rw-r--r--numpy/random/tests/data/xorshift1024-testset-2.csv (renamed from numpy/random/randomgen/tests/data/xorshift1024-testset-2.csv)0
-rw-r--r--numpy/random/tests/data/xoshiro256starstar-testset-1.csv (renamed from numpy/random/randomgen/tests/data/xoshiro256starstar-testset-1.csv)0
-rw-r--r--numpy/random/tests/data/xoshiro256starstar-testset-2.csv (renamed from numpy/random/randomgen/tests/data/xoshiro256starstar-testset-2.csv)0
-rw-r--r--numpy/random/tests/data/xoshiro512starstar-testset-1.csv (renamed from numpy/random/randomgen/tests/data/xoshiro512starstar-testset-1.csv)0
-rw-r--r--numpy/random/tests/data/xoshiro512starstar-testset-2.csv (renamed from numpy/random/randomgen/tests/data/xoshiro512starstar-testset-2.csv)0
-rw-r--r--numpy/random/tests/test_against_numpy.py (renamed from numpy/random/randomgen/tests/test_against_numpy.py)38
-rw-r--r--numpy/random/tests/test_direct.py (renamed from numpy/random/randomgen/tests/test_direct.py)108
-rw-r--r--numpy/random/tests/test_generator_mt19937.py (renamed from numpy/random/randomgen/tests/test_generator_mt19937.py)169
-rw-r--r--numpy/random/tests/test_generator_mt19937_regressions.py (renamed from numpy/random/randomgen/tests/test_generator_mt19937_regressions.py)26
-rw-r--r--numpy/random/tests/test_randomstate.py (renamed from numpy/random/randomgen/tests/test_randomstate.py)2
-rw-r--r--numpy/random/tests/test_randomstate_regression.py (renamed from numpy/random/randomgen/tests/test_randomstate_regression.py)2
-rw-r--r--numpy/random/tests/test_smoke.py (renamed from numpy/random/randomgen/tests/test_smoke.py)228
-rw-r--r--numpy/random/threefry.pyx (renamed from numpy/random/randomgen/threefry.pyx)0
-rw-r--r--numpy/random/threefry32.pyx (renamed from numpy/random/randomgen/threefry32.pyx)0
-rw-r--r--numpy/random/xoroshiro128.pyx (renamed from numpy/random/randomgen/xoroshiro128.pyx)0
-rw-r--r--numpy/random/xorshift1024.pyx (renamed from numpy/random/randomgen/xorshift1024.pyx)0
-rw-r--r--numpy/random/xoshiro256starstar.pyx (renamed from numpy/random/randomgen/xoshiro256starstar.pyx)0
-rw-r--r--numpy/random/xoshiro512starstar.pyx (renamed from numpy/random/randomgen/xoshiro512starstar.pyx)0
176 files changed, 508 insertions, 1102 deletions
diff --git a/numpy/random/randomgen/LICENSE.md b/numpy/random/LICENSE.md
index caa665373..caa665373 100644
--- a/numpy/random/randomgen/LICENSE.md
+++ b/numpy/random/LICENSE.md
diff --git a/numpy/random/__init__.py b/numpy/random/__init__.py
index 53e947797..89015d6a2 100644
--- a/numpy/random/__init__.py
+++ b/numpy/random/__init__.py
@@ -83,6 +83,22 @@ get_state Get tuple representing internal state of generator.
set_state Set state of generator.
==================== =========================================================
+==================== =========================================================
+Random Number Streams that work with RandomGenerator
+==============================================================================
+MT19937
+DSFMT
+PCG32
+PCG64
+Philox
+ThreeFry
+ThreeFry32
+Xoroshiro128
+Xoroshift1024
+Xoshiro256StarStar
+Xoshiro512StarStar
+==================== =========================================================
+
"""
from __future__ import division, absolute_import, print_function
@@ -136,8 +152,24 @@ __all__ = [
'zipf'
]
-from .randomgen import mtrand
-from .randomgen.mtrand import *
+from . import mtrand
+from .mtrand import *
+from .dsfmt import DSFMT
+from .generator import RandomGenerator
+from .mt19937 import MT19937
+from .pcg32 import PCG32
+from .pcg64 import PCG64
+from .philox import Philox
+from .threefry import ThreeFry
+from .threefry32 import ThreeFry32
+from .xoroshiro128 import Xoroshiro128
+from .xorshift1024 import Xorshift1024
+from .xoshiro256starstar import Xoshiro256StarStar
+from .xoshiro512starstar import Xoshiro512StarStar
+from .mtrand import RandomState
+__all__ += ['RandomGenerator', 'DSFMT', 'MT19937', 'PCG64', 'PCG32', 'Philox',
+ 'ThreeFry', 'ThreeFry32', 'Xoroshiro128', 'Xorshift1024',
+ 'Xoshiro256StarStar', 'Xoshiro512StarStar', 'RandomState']
# Some aliases:
ranf = random = sample = random_sample
diff --git a/numpy/random/mtrand/Python.pxi b/numpy/random/_mtrand/Python.pxi
index 08aadbaa1..08aadbaa1 100644
--- a/numpy/random/mtrand/Python.pxi
+++ b/numpy/random/_mtrand/Python.pxi
diff --git a/numpy/random/mtrand/distributions.c b/numpy/random/_mtrand/distributions.c
index 1b410db57..1b410db57 100644
--- a/numpy/random/mtrand/distributions.c
+++ b/numpy/random/_mtrand/distributions.c
diff --git a/numpy/random/mtrand/distributions.h b/numpy/random/_mtrand/distributions.h
index 0b42bc794..0b42bc794 100644
--- a/numpy/random/mtrand/distributions.h
+++ b/numpy/random/_mtrand/distributions.h
diff --git a/numpy/random/_mtrand/generate_mtrand_c.py b/numpy/random/_mtrand/generate_mtrand_c.py
new file mode 100644
index 000000000..ec935e6dd
--- /dev/null
+++ b/numpy/random/_mtrand/generate_mtrand_c.py
@@ -0,0 +1,42 @@
+#!/usr/bin/env python
+from __future__ import division, absolute_import, print_function
+
+import sys
+import re
+import os
+
+unused_internal_funcs = ['__Pyx_PrintItem',
+ '__Pyx_PrintNewline',
+ '__Pyx_ReRaise',
+ #'__Pyx_GetExcValue',
+ '__Pyx_ArgTypeTest',
+ '__Pyx_SetVtable',
+ '__Pyx_GetVtable',
+ '__Pyx_CreateClass']
+
+if __name__ == '__main__':
+ # Use cython here so that long docstrings are broken up.
+ # This is needed for some VC++ compilers.
+ os.system('cython mtrand.pyx')
+ mtrand_c = open('mtrand.c', 'r')
+ processed = open('mtrand_pp.c', 'w')
+ unused_funcs_str = '(' + '|'.join(unused_internal_funcs) + ')'
+ uifpat = re.compile(r'static \w+ \*?'+unused_funcs_str+r'.*/\*proto\*/')
+ linepat = re.compile(r'/\* ".*/mtrand.pyx":')
+ for linenum, line in enumerate(mtrand_c):
+ m = re.match(r'^(\s+arrayObject\w*\s*=\s*[(])[(]PyObject\s*[*][)]',
+ line)
+ if m:
+ line = '%s(PyArrayObject *)%s' % (m.group(1), line[m.end():])
+ m = uifpat.match(line)
+ if m:
+ line = ''
+ m = re.search(unused_funcs_str, line)
+ if m:
+ print("%s was declared unused, but is used at line %d" % (m.group(),
+ linenum+1), file=sys.stderr)
+ line = linepat.sub(r'/* "mtrand.pyx":', line)
+ processed.write(line)
+ mtrand_c.close()
+ processed.close()
+ os.rename('mtrand_pp.c', 'mtrand.c')
diff --git a/numpy/random/mtrand/initarray.c b/numpy/random/_mtrand/initarray.c
index beff78510..beff78510 100644
--- a/numpy/random/mtrand/initarray.c
+++ b/numpy/random/_mtrand/initarray.c
diff --git a/numpy/random/mtrand/initarray.h b/numpy/random/_mtrand/initarray.h
index f5e5e5332..f5e5e5332 100644
--- a/numpy/random/mtrand/initarray.h
+++ b/numpy/random/_mtrand/initarray.h
diff --git a/numpy/random/mtrand/mtrand.pyx b/numpy/random/_mtrand/mtrand.pyx
index 329d5cd68..329d5cd68 100644
--- a/numpy/random/mtrand/mtrand.pyx
+++ b/numpy/random/_mtrand/mtrand.pyx
diff --git a/numpy/random/mtrand/mtrand_py_helper.h b/numpy/random/_mtrand/mtrand_py_helper.h
index 266847cbe..266847cbe 100644
--- a/numpy/random/mtrand/mtrand_py_helper.h
+++ b/numpy/random/_mtrand/mtrand_py_helper.h
diff --git a/numpy/random/mtrand/numpy.pxd b/numpy/random/_mtrand/numpy.pxd
index e146054b1..e146054b1 100644
--- a/numpy/random/mtrand/numpy.pxd
+++ b/numpy/random/_mtrand/numpy.pxd
diff --git a/numpy/random/mtrand/randint_helpers.pxi.in b/numpy/random/_mtrand/randint_helpers.pxi.in
index 894a25167..894a25167 100644
--- a/numpy/random/mtrand/randint_helpers.pxi.in
+++ b/numpy/random/_mtrand/randint_helpers.pxi.in
diff --git a/numpy/random/mtrand/randomkit.c b/numpy/random/_mtrand/randomkit.c
index 6371ebe33..6371ebe33 100644
--- a/numpy/random/mtrand/randomkit.c
+++ b/numpy/random/_mtrand/randomkit.c
diff --git a/numpy/random/mtrand/randomkit.h b/numpy/random/_mtrand/randomkit.h
index a24dabebf..a24dabebf 100644
--- a/numpy/random/mtrand/randomkit.h
+++ b/numpy/random/_mtrand/randomkit.h
diff --git a/numpy/random/randomgen/_pickle.py b/numpy/random/_pickle.py
index 1c365b0c7..1c365b0c7 100644
--- a/numpy/random/randomgen/_pickle.py
+++ b/numpy/random/_pickle.py
diff --git a/numpy/random/randomgen/bounded_integers.pxd.in b/numpy/random/bounded_integers.pxd.in
index 4ab389fd9..4ab389fd9 100644
--- a/numpy/random/randomgen/bounded_integers.pxd.in
+++ b/numpy/random/bounded_integers.pxd.in
diff --git a/numpy/random/randomgen/bounded_integers.pyx.in b/numpy/random/bounded_integers.pyx.in
index 03068a8fd..03068a8fd 100644
--- a/numpy/random/randomgen/bounded_integers.pyx.in
+++ b/numpy/random/bounded_integers.pyx.in
diff --git a/numpy/random/randomgen/common.pxd b/numpy/random/common.pxd
index f6748e5aa..f6748e5aa 100644
--- a/numpy/random/randomgen/common.pxd
+++ b/numpy/random/common.pxd
diff --git a/numpy/random/randomgen/common.pyx b/numpy/random/common.pyx
index ebd2e60d1..ebd2e60d1 100644
--- a/numpy/random/randomgen/common.pyx
+++ b/numpy/random/common.pyx
diff --git a/numpy/random/randomgen/distributions.pxd b/numpy/random/distributions.pxd
index ddb7a84bf..ddb7a84bf 100644
--- a/numpy/random/randomgen/distributions.pxd
+++ b/numpy/random/distributions.pxd
diff --git a/numpy/random/randomgen/dsfmt.pyx b/numpy/random/dsfmt.pyx
index 9a7199e85..9a7199e85 100644
--- a/numpy/random/randomgen/dsfmt.pyx
+++ b/numpy/random/dsfmt.pyx
diff --git a/numpy/random/randomgen/entropy.pyx b/numpy/random/entropy.pyx
index 0e429e9f2..0e429e9f2 100644
--- a/numpy/random/randomgen/entropy.pyx
+++ b/numpy/random/entropy.pyx
diff --git a/numpy/random/randomgen/examples/cython/extending.pyx b/numpy/random/examples/cython/extending.pyx
index b472312b4..b472312b4 100644
--- a/numpy/random/randomgen/examples/cython/extending.pyx
+++ b/numpy/random/examples/cython/extending.pyx
diff --git a/numpy/random/randomgen/examples/cython/extending_distributions.pyx b/numpy/random/examples/cython/extending_distributions.pyx
index 26d749b10..26d749b10 100644
--- a/numpy/random/randomgen/examples/cython/extending_distributions.pyx
+++ b/numpy/random/examples/cython/extending_distributions.pyx
diff --git a/numpy/random/randomgen/examples/cython/setup.py b/numpy/random/examples/cython/setup.py
index d7a04f75a..d7a04f75a 100644
--- a/numpy/random/randomgen/examples/cython/setup.py
+++ b/numpy/random/examples/cython/setup.py
diff --git a/numpy/random/randomgen/examples/numba/extending.py b/numpy/random/examples/numba/extending.py
index 72e903b1f..72e903b1f 100644
--- a/numpy/random/randomgen/examples/numba/extending.py
+++ b/numpy/random/examples/numba/extending.py
diff --git a/numpy/random/randomgen/examples/numba/extending_distributions.py b/numpy/random/examples/numba/extending_distributions.py
index 17ba2704c..17ba2704c 100644
--- a/numpy/random/randomgen/examples/numba/extending_distributions.py
+++ b/numpy/random/examples/numba/extending_distributions.py
diff --git a/numpy/random/randomgen/generator.pyx b/numpy/random/generator.pyx
index a244bca57..e68edb98a 100644
--- a/numpy/random/randomgen/generator.pyx
+++ b/numpy/random/generator.pyx
@@ -49,7 +49,7 @@ cdef class RandomGenerator:
Notes
-----
- The Python stdlib module "random" contains pseudo-random number generator
+ The Python stdlib module `random` contains pseudo-random number generator
with a number of methods that are similar to the ones available in
``RandomGenerator``. It uses Mersenne Twister, and this basic RNG can be
accessed using ``MT19937``. ``RandomGenerator``, besides being
@@ -72,7 +72,7 @@ cdef class RandomGenerator:
>>> rg = MT19937().generator
>>> rg.standard_normal()
"""
- cdef public object _basicrng
+ cdef public object brng
cdef brng_t *_brng
cdef binomial_t *_binomial
cdef object lock
@@ -81,7 +81,7 @@ cdef class RandomGenerator:
def __init__(self, brng=None):
if brng is None:
brng = Xoroshiro128()
- self._basicrng = brng
+ self.brng = brng
capsule = brng.capsule
cdef const char *name = "BasicRNG"
@@ -99,79 +99,21 @@ cdef class RandomGenerator:
def __str__(self):
_str = self.__class__.__name__
- _str += '(' + self._basicrng.__class__.__name__ + ')'
+ _str += '(' + self.brng.__class__.__name__ + ')'
return _str
# Pickling support:
def __getstate__(self):
- return self.state
+ return self.brng.state
def __setstate__(self, state):
- self.state = state
+ self.brng.state = state
def __reduce__(self):
from ._pickle import __generator_ctor
return (__generator_ctor,
- (self.state['brng'],),
- self.state)
-
- def seed(self, *args, **kwargs):
- """
- Reseed the basic RNG.
-
- Parameters depend on the basic RNG used.
-
- Notes
- -----
- Arguments are directly passed to the basic RNG. This is a convenience
- function.
-
- The best method to access seed is to directly use a basic RNG instance.
- This example demonstrates this best practice.
-
- >>> from numpy.random.randomgen import RandomGenerator, PCG64
- >>> brng = PCG64(1234567891011)
- >>> rg = brng.generator
- >>> brng.seed(1110987654321)
-
- The method used to create the generator is not important.
-
- >>> brng = PCG64(1234567891011)
- >>> rg = RandomGenerator(brng)
- >>> brng.seed(1110987654321)
-
- These best practice examples are equivalent to
-
- >>> rg = RandomGenerator(PCG64(1234567891011))
- >>> rg.seed(1110987654321)
-
- """
- # TODO: Should this remain
- self._basicrng.seed(*args, **kwargs)
- return self
-
- @property
- def state(self):
- """
- Get or set the Basic RNG's state
-
- Returns
- -------
- state : dict
- Dictionary containing the information required to describe the
- state of the Basic RNG
-
- Notes
- -----
- This is a trivial pass-through function. RandomGenerator does not
- directly contain or manipulate the basic RNG's state.
-
- """
- return self._basicrng.state
-
- @state.setter
- def state(self, value):
- self._basicrng.state = value
+ (self.brng.state['brng'],),
+ self.brng.state)
def random_sample(self, size=None, dtype=np.float64, out=None):
"""
diff --git a/numpy/random/randomgen/legacy/__init__.py b/numpy/random/legacy/__init__.py
index 9ce1f665d..9ce1f665d 100644
--- a/numpy/random/randomgen/legacy/__init__.py
+++ b/numpy/random/legacy/__init__.py
diff --git a/numpy/random/randomgen/legacy/legacy_distributions.pxd b/numpy/random/legacy/legacy_distributions.pxd
index bc00994db..bc00994db 100644
--- a/numpy/random/randomgen/legacy/legacy_distributions.pxd
+++ b/numpy/random/legacy/legacy_distributions.pxd
diff --git a/numpy/random/randomgen/mt19937.pyx b/numpy/random/mt19937.pyx
index 306ce23e2..306ce23e2 100644
--- a/numpy/random/randomgen/mt19937.pyx
+++ b/numpy/random/mt19937.pyx
diff --git a/numpy/random/randomgen/mtrand.pyx b/numpy/random/mtrand.pyx
index b5d6ff9bc..b5d6ff9bc 100644
--- a/numpy/random/randomgen/mtrand.pyx
+++ b/numpy/random/mtrand.pyx
diff --git a/numpy/random/randomgen/pcg32.pyx b/numpy/random/pcg32.pyx
index 5f2b34807..5f2b34807 100644
--- a/numpy/random/randomgen/pcg32.pyx
+++ b/numpy/random/pcg32.pyx
diff --git a/numpy/random/randomgen/pcg64.pyx b/numpy/random/pcg64.pyx
index f67d9623c..f67d9623c 100644
--- a/numpy/random/randomgen/pcg64.pyx
+++ b/numpy/random/pcg64.pyx
diff --git a/numpy/random/randomgen/philox.pyx b/numpy/random/philox.pyx
index 70afd55ab..70afd55ab 100644
--- a/numpy/random/randomgen/philox.pyx
+++ b/numpy/random/philox.pyx
diff --git a/numpy/random/randomgen/__init__.py b/numpy/random/randomgen/__init__.py
deleted file mode 100644
index 1af2fc3b2..000000000
--- a/numpy/random/randomgen/__init__.py
+++ /dev/null
@@ -1,21 +0,0 @@
-from .dsfmt import DSFMT
-from .generator import RandomGenerator
-from .mt19937 import MT19937
-from .pcg32 import PCG32
-from .pcg64 import PCG64
-from .philox import Philox
-from .threefry import ThreeFry
-from .threefry32 import ThreeFry32
-from .xoroshiro128 import Xoroshiro128
-from .xorshift1024 import Xorshift1024
-from .xoshiro256starstar import Xoshiro256StarStar
-from .xoshiro512starstar import Xoshiro512StarStar
-from .mtrand import RandomState
-__all__ = ['RandomGenerator', 'DSFMT', 'MT19937', 'PCG64', 'PCG32', 'Philox',
- 'ThreeFry', 'ThreeFry32', 'Xoroshiro128', 'Xorshift1024',
- 'Xoshiro256StarStar', 'Xoshiro512StarStar', 'RandomState']
-
-#from ._version import get_versions
-
-#__version__ = get_versions()['version']
-#del get_versions
diff --git a/numpy/random/randomgen/_version.py b/numpy/random/randomgen/_version.py
deleted file mode 100644
index e400e3efb..000000000
--- a/numpy/random/randomgen/_version.py
+++ /dev/null
@@ -1,520 +0,0 @@
-
-# This file helps to compute a version number in source trees obtained from
-# git-archive tarball (such as those provided by githubs download-from-tag
-# feature). Distribution tarballs (built by setup.py sdist) and build
-# directories (produced by setup.py build) will contain a much shorter file
-# that just contains the computed version number.
-
-# This file is released into the public domain. Generated by
-# versioneer-0.18 (https://github.com/warner/python-versioneer)
-
-"""Git implementation of _version.py."""
-
-import errno
-import os
-import re
-import subprocess
-import sys
-
-
-def get_keywords():
- """Get the keywords needed to look up the version information."""
- # these strings will be replaced by git during git-archive.
- # setup.py/versioneer.py will grep for the variable names, so they must
- # each be defined on a line of their own. _version.py will just call
- # get_keywords().
- git_refnames = "$Format:%d$"
- git_full = "$Format:%H$"
- git_date = "$Format:%ci$"
- keywords = {"refnames": git_refnames, "full": git_full, "date": git_date}
- return keywords
-
-
-class VersioneerConfig:
- """Container for Versioneer configuration parameters."""
-
-
-def get_config():
- """Create, populate and return the VersioneerConfig() object."""
- # these strings are filled in when 'setup.py versioneer' creates
- # _version.py
- cfg = VersioneerConfig()
- cfg.VCS = "git"
- cfg.style = "pep440"
- cfg.tag_prefix = ""
- cfg.parentdir_prefix = "randomgen-"
- cfg.versionfile_source = "randomgen/_version.py"
- cfg.verbose = False
- return cfg
-
-
-class NotThisMethod(Exception):
- """Exception raised if a method is not valid for the current scenario."""
-
-
-LONG_VERSION_PY = {}
-HANDLERS = {}
-
-
-def register_vcs_handler(vcs, method): # decorator
- """Decorator to mark a method as the handler for a particular VCS."""
- def decorate(f):
- """Store f in HANDLERS[vcs][method]."""
- if vcs not in HANDLERS:
- HANDLERS[vcs] = {}
- HANDLERS[vcs][method] = f
- return f
- return decorate
-
-
-def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False,
- env=None):
- """Call the given command(s)."""
- assert isinstance(commands, list)
- p = None
- for c in commands:
- try:
- dispcmd = str([c] + args)
- # remember shell=False, so use git.cmd on windows, not just git
- p = subprocess.Popen([c] + args, cwd=cwd, env=env,
- stdout=subprocess.PIPE,
- stderr=(subprocess.PIPE if hide_stderr
- else None))
- break
- except EnvironmentError:
- e = sys.exc_info()[1]
- if e.errno == errno.ENOENT:
- continue
- if verbose:
- print("unable to run %s" % dispcmd)
- print(e)
- return None, None
- else:
- if verbose:
- print("unable to find command, tried %s" % (commands,))
- return None, None
- stdout = p.communicate()[0].strip()
- if sys.version_info[0] >= 3:
- stdout = stdout.decode()
- if p.returncode != 0:
- if verbose:
- print("unable to run %s (error)" % dispcmd)
- print("stdout was %s" % stdout)
- return None, p.returncode
- return stdout, p.returncode
-
-
-def versions_from_parentdir(parentdir_prefix, root, verbose):
- """Try to determine the version from the parent directory name.
-
- Source tarballs conventionally unpack into a directory that includes both
- the project name and a version string. We will also support searching up
- two directory levels for an appropriately named parent directory
- """
- rootdirs = []
-
- for i in range(3):
- dirname = os.path.basename(root)
- if dirname.startswith(parentdir_prefix):
- return {"version": dirname[len(parentdir_prefix):],
- "full-revisionid": None,
- "dirty": False, "error": None, "date": None}
- else:
- rootdirs.append(root)
- root = os.path.dirname(root) # up a level
-
- if verbose:
- print("Tried directories %s but none started with prefix %s" %
- (str(rootdirs), parentdir_prefix))
- raise NotThisMethod("rootdir doesn't start with parentdir_prefix")
-
-
-@register_vcs_handler("git", "get_keywords")
-def git_get_keywords(versionfile_abs):
- """Extract version information from the given file."""
- # the code embedded in _version.py can just fetch the value of these
- # keywords. When used from setup.py, we don't want to import _version.py,
- # so we do it with a regexp instead. This function is not used from
- # _version.py.
- keywords = {}
- try:
- f = open(versionfile_abs, "r")
- for line in f.readlines():
- if line.strip().startswith("git_refnames ="):
- mo = re.search(r'=\s*"(.*)"', line)
- if mo:
- keywords["refnames"] = mo.group(1)
- if line.strip().startswith("git_full ="):
- mo = re.search(r'=\s*"(.*)"', line)
- if mo:
- keywords["full"] = mo.group(1)
- if line.strip().startswith("git_date ="):
- mo = re.search(r'=\s*"(.*)"', line)
- if mo:
- keywords["date"] = mo.group(1)
- f.close()
- except EnvironmentError:
- pass
- return keywords
-
-
-@register_vcs_handler("git", "keywords")
-def git_versions_from_keywords(keywords, tag_prefix, verbose):
- """Get version information from git keywords."""
- if not keywords:
- raise NotThisMethod("no keywords at all, weird")
- date = keywords.get("date")
- if date is not None:
- # git-2.2.0 added "%cI", which expands to an ISO-8601 -compliant
- # datestamp. However we prefer "%ci" (which expands to an "ISO-8601
- # -like" string, which we must then edit to make compliant), because
- # it's been around since git-1.5.3, and it's too difficult to
- # discover which version we're using, or to work around using an
- # older one.
- date = date.strip().replace(" ", "T", 1).replace(" ", "", 1)
- refnames = keywords["refnames"].strip()
- if refnames.startswith("$Format"):
- if verbose:
- print("keywords are unexpanded, not using")
- raise NotThisMethod("unexpanded keywords, not a git-archive tarball")
- refs = set([r.strip() for r in refnames.strip("()").split(",")])
- # starting in git-1.8.3, tags are listed as "tag: foo-1.0" instead of
- # just "foo-1.0". If we see a "tag: " prefix, prefer those.
- TAG = "tag: "
- tags = set([r[len(TAG):] for r in refs if r.startswith(TAG)])
- if not tags:
- # Either we're using git < 1.8.3, or there really are no tags. We use
- # a heuristic: assume all version tags have a digit. The old git %d
- # expansion behaves like git log --decorate=short and strips out the
- # refs/heads/ and refs/tags/ prefixes that would let us distinguish
- # between branches and tags. By ignoring refnames without digits, we
- # filter out many common branch names like "release" and
- # "stabilization", as well as "HEAD" and "master".
- tags = set([r for r in refs if re.search(r'\d', r)])
- if verbose:
- print("discarding '%s', no digits" % ",".join(refs - tags))
- if verbose:
- print("likely tags: %s" % ",".join(sorted(tags)))
- for ref in sorted(tags):
- # sorting will prefer e.g. "2.0" over "2.0rc1"
- if ref.startswith(tag_prefix):
- r = ref[len(tag_prefix):]
- if verbose:
- print("picking %s" % r)
- return {"version": r,
- "full-revisionid": keywords["full"].strip(),
- "dirty": False, "error": None,
- "date": date}
- # no suitable tags, so version is "0+unknown", but full hex is still there
- if verbose:
- print("no suitable tags, using unknown + full revision id")
- return {"version": "0+unknown",
- "full-revisionid": keywords["full"].strip(),
- "dirty": False, "error": "no suitable tags", "date": None}
-
-
-@register_vcs_handler("git", "pieces_from_vcs")
-def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command):
- """Get version from 'git describe' in the root of the source tree.
-
- This only gets called if the git-archive 'subst' keywords were *not*
- expanded, and _version.py hasn't already been rewritten with a short
- version string, meaning we're inside a checked out source tree.
- """
- GITS = ["git"]
- if sys.platform == "win32":
- GITS = ["git.cmd", "git.exe"]
-
- out, rc = run_command(GITS, ["rev-parse", "--git-dir"], cwd=root,
- hide_stderr=True)
- if rc != 0:
- if verbose:
- print("Directory %s not under git control" % root)
- raise NotThisMethod("'git rev-parse --git-dir' returned error")
-
- # if there is a tag matching tag_prefix, this yields TAG-NUM-gHEX[-dirty]
- # if there isn't one, this yields HEX[-dirty] (no NUM)
- describe_out, rc = run_command(GITS, ["describe", "--tags", "--dirty",
- "--always", "--long",
- "--match", "%s*" % tag_prefix],
- cwd=root)
- # --long was added in git-1.5.5
- if describe_out is None:
- raise NotThisMethod("'git describe' failed")
- describe_out = describe_out.strip()
- full_out, rc = run_command(GITS, ["rev-parse", "HEAD"], cwd=root)
- if full_out is None:
- raise NotThisMethod("'git rev-parse' failed")
- full_out = full_out.strip()
-
- pieces = {}
- pieces["long"] = full_out
- pieces["short"] = full_out[:7] # maybe improved later
- pieces["error"] = None
-
- # parse describe_out. It will be like TAG-NUM-gHEX[-dirty] or HEX[-dirty]
- # TAG might have hyphens.
- git_describe = describe_out
-
- # look for -dirty suffix
- dirty = git_describe.endswith("-dirty")
- pieces["dirty"] = dirty
- if dirty:
- git_describe = git_describe[:git_describe.rindex("-dirty")]
-
- # now we have TAG-NUM-gHEX or HEX
-
- if "-" in git_describe:
- # TAG-NUM-gHEX
- mo = re.search(r'^(.+)-(\d+)-g([0-9a-f]+)$', git_describe)
- if not mo:
- # unparseable. Maybe git-describe is misbehaving?
- pieces["error"] = ("unable to parse git-describe output: '%s'"
- % describe_out)
- return pieces
-
- # tag
- full_tag = mo.group(1)
- if not full_tag.startswith(tag_prefix):
- if verbose:
- fmt = "tag '%s' doesn't start with prefix '%s'"
- print(fmt % (full_tag, tag_prefix))
- pieces["error"] = ("tag '%s' doesn't start with prefix '%s'"
- % (full_tag, tag_prefix))
- return pieces
- pieces["closest-tag"] = full_tag[len(tag_prefix):]
-
- # distance: number of commits since tag
- pieces["distance"] = int(mo.group(2))
-
- # commit: short hex revision ID
- pieces["short"] = mo.group(3)
-
- else:
- # HEX: no tags
- pieces["closest-tag"] = None
- count_out, rc = run_command(GITS, ["rev-list", "HEAD", "--count"],
- cwd=root)
- pieces["distance"] = int(count_out) # total number of commits
-
- # commit date: see ISO-8601 comment in git_versions_from_keywords()
- date = run_command(GITS, ["show", "-s", "--format=%ci", "HEAD"],
- cwd=root)[0].strip()
- pieces["date"] = date.strip().replace(" ", "T", 1).replace(" ", "", 1)
-
- return pieces
-
-
-def plus_or_dot(pieces):
- """Return a + if we don't already have one, else return a ."""
- if "+" in pieces.get("closest-tag", ""):
- return "."
- return "+"
-
-
-def render_pep440(pieces):
- """Build up version string, with post-release "local version identifier".
-
- Our goal: TAG[+DISTANCE.gHEX[.dirty]] . Note that if you
- get a tagged build and then dirty it, you'll get TAG+0.gHEX.dirty
-
- Exceptions:
- 1: no tags. git_describe was just HEX. 0+untagged.DISTANCE.gHEX[.dirty]
- """
- if pieces["closest-tag"]:
- rendered = pieces["closest-tag"]
- if pieces["distance"] or pieces["dirty"]:
- rendered += plus_or_dot(pieces)
- rendered += "%d.g%s" % (pieces["distance"], pieces["short"])
- if pieces["dirty"]:
- rendered += ".dirty"
- else:
- # exception #1
- rendered = "0+untagged.%d.g%s" % (pieces["distance"],
- pieces["short"])
- if pieces["dirty"]:
- rendered += ".dirty"
- return rendered
-
-
-def render_pep440_pre(pieces):
- """TAG[.post.devDISTANCE] -- No -dirty.
-
- Exceptions:
- 1: no tags. 0.post.devDISTANCE
- """
- if pieces["closest-tag"]:
- rendered = pieces["closest-tag"]
- if pieces["distance"]:
- rendered += ".post.dev%d" % pieces["distance"]
- else:
- # exception #1
- rendered = "0.post.dev%d" % pieces["distance"]
- return rendered
-
-
-def render_pep440_post(pieces):
- """TAG[.postDISTANCE[.dev0]+gHEX] .
-
- The ".dev0" means dirty. Note that .dev0 sorts backwards
- (a dirty tree will appear "older" than the corresponding clean one),
- but you shouldn't be releasing software with -dirty anyways.
-
- Exceptions:
- 1: no tags. 0.postDISTANCE[.dev0]
- """
- if pieces["closest-tag"]:
- rendered = pieces["closest-tag"]
- if pieces["distance"] or pieces["dirty"]:
- rendered += ".post%d" % pieces["distance"]
- if pieces["dirty"]:
- rendered += ".dev0"
- rendered += plus_or_dot(pieces)
- rendered += "g%s" % pieces["short"]
- else:
- # exception #1
- rendered = "0.post%d" % pieces["distance"]
- if pieces["dirty"]:
- rendered += ".dev0"
- rendered += "+g%s" % pieces["short"]
- return rendered
-
-
-def render_pep440_old(pieces):
- """TAG[.postDISTANCE[.dev0]] .
-
- The ".dev0" means dirty.
-
- Eexceptions:
- 1: no tags. 0.postDISTANCE[.dev0]
- """
- if pieces["closest-tag"]:
- rendered = pieces["closest-tag"]
- if pieces["distance"] or pieces["dirty"]:
- rendered += ".post%d" % pieces["distance"]
- if pieces["dirty"]:
- rendered += ".dev0"
- else:
- # exception #1
- rendered = "0.post%d" % pieces["distance"]
- if pieces["dirty"]:
- rendered += ".dev0"
- return rendered
-
-
-def render_git_describe(pieces):
- """TAG[-DISTANCE-gHEX][-dirty].
-
- Like 'git describe --tags --dirty --always'.
-
- Exceptions:
- 1: no tags. HEX[-dirty] (note: no 'g' prefix)
- """
- if pieces["closest-tag"]:
- rendered = pieces["closest-tag"]
- if pieces["distance"]:
- rendered += "-%d-g%s" % (pieces["distance"], pieces["short"])
- else:
- # exception #1
- rendered = pieces["short"]
- if pieces["dirty"]:
- rendered += "-dirty"
- return rendered
-
-
-def render_git_describe_long(pieces):
- """TAG-DISTANCE-gHEX[-dirty].
-
- Like 'git describe --tags --dirty --always -long'.
- The distance/hash is unconditional.
-
- Exceptions:
- 1: no tags. HEX[-dirty] (note: no 'g' prefix)
- """
- if pieces["closest-tag"]:
- rendered = pieces["closest-tag"]
- rendered += "-%d-g%s" % (pieces["distance"], pieces["short"])
- else:
- # exception #1
- rendered = pieces["short"]
- if pieces["dirty"]:
- rendered += "-dirty"
- return rendered
-
-
-def render(pieces, style):
- """Render the given version pieces into the requested style."""
- if pieces["error"]:
- return {"version": "unknown",
- "full-revisionid": pieces.get("long"),
- "dirty": None,
- "error": pieces["error"],
- "date": None}
-
- if not style or style == "default":
- style = "pep440" # the default
-
- if style == "pep440":
- rendered = render_pep440(pieces)
- elif style == "pep440-pre":
- rendered = render_pep440_pre(pieces)
- elif style == "pep440-post":
- rendered = render_pep440_post(pieces)
- elif style == "pep440-old":
- rendered = render_pep440_old(pieces)
- elif style == "git-describe":
- rendered = render_git_describe(pieces)
- elif style == "git-describe-long":
- rendered = render_git_describe_long(pieces)
- else:
- raise ValueError("unknown style '%s'" % style)
-
- return {"version": rendered, "full-revisionid": pieces["long"],
- "dirty": pieces["dirty"], "error": None,
- "date": pieces.get("date")}
-
-
-def get_versions():
- """Get version information or return default if unable to do so."""
- # I am in _version.py, which lives at ROOT/VERSIONFILE_SOURCE. If we have
- # __file__, we can work backwards from there to the root. Some
- # py2exe/bbfreeze/non-CPython implementations don't do __file__, in which
- # case we can only use expanded keywords.
-
- cfg = get_config()
- verbose = cfg.verbose
-
- try:
- return git_versions_from_keywords(get_keywords(), cfg.tag_prefix,
- verbose)
- except NotThisMethod:
- pass
-
- try:
- root = os.path.realpath(__file__)
- # versionfile_source is the relative path from the top of the source
- # tree (where the .git directory might live) to this file. Invert
- # this to find the root from __file__.
- for i in cfg.versionfile_source.split('/'):
- root = os.path.dirname(root)
- except NameError:
- return {"version": "0+unknown", "full-revisionid": None,
- "dirty": None,
- "error": "unable to find root of source tree",
- "date": None}
-
- try:
- pieces = git_pieces_from_vcs(cfg.tag_prefix, root, verbose)
- return render(pieces, cfg.style)
- except NotThisMethod:
- pass
-
- try:
- if cfg.parentdir_prefix:
- return versions_from_parentdir(cfg.parentdir_prefix, root, verbose)
- except NotThisMethod:
- pass
-
- return {"version": "0+unknown", "full-revisionid": None,
- "dirty": None,
- "error": "unable to compute version", "date": None}
diff --git a/numpy/random/randomgen/setup.py b/numpy/random/randomgen/setup.py
deleted file mode 100644
index 5b7be4559..000000000
--- a/numpy/random/randomgen/setup.py
+++ /dev/null
@@ -1,191 +0,0 @@
-from os.path import join
-import sys
-import os
-import platform
-import struct
-from distutils.dep_util import newer
-from distutils.msvccompiler import get_build_version as get_msvc_build_version
-
-def needs_mingw_ftime_workaround():
- # We need the mingw workaround for _ftime if the msvc runtime version is
- # 7.1 or above and we build with mingw ...
- # ... but we can't easily detect compiler version outside distutils command
- # context, so we will need to detect in randomkit whether we build with gcc
- msver = get_msvc_build_version()
- if msver and msver >= 8:
- return True
-
- return False
-
-
-def configuration(parent_package='',top_path=None):
- from numpy.distutils.misc_util import Configuration, get_mathlibs
- config = Configuration('randomgen', parent_package, top_path)
-
- def generate_libraries(ext, build_dir):
- config_cmd = config.get_config_cmd()
- libs = get_mathlibs()
- if sys.platform == 'win32':
- libs.append('Advapi32')
- ext.libraries.extend(libs)
- return None
-
- # enable unix large file support on 32 bit systems
- # (64 bit off_t, lseek -> lseek64 etc.)
- if sys.platform[:3] == "aix":
- defs = [('_LARGE_FILES', None)]
- else:
- defs = [('_FILE_OFFSET_BITS', '64'),
- ('_LARGEFILE_SOURCE', '1'),
- ('_LARGEFILE64_SOURCE', '1')]
- if needs_mingw_ftime_workaround():
- defs.append(("NPY_NEEDS_MINGW_TIME_WORKAROUND", None))
-
- libs = []
- defs.append(('NPY_NO_DEPRECATED_API', 0))
- config.add_data_dir('tests')
-
- ##############################
- # randomgen
- ##############################
-
- # Make a guess as to whether SSE2 is present for now, TODO: Improve
- USE_SSE2 = False
- for k in platform.uname():
- for val in ('x86', 'i686', 'i386', 'amd64'):
- USE_SSE2 = USE_SSE2 or val in k.lower()
- print('Building with SSE?: {0}'.format(USE_SSE2))
- if '--no-sse2' in sys.argv:
- USE_SSE2 = False
- sys.argv.remove('--no-sse2')
-
- DEBUG = False
- PCG_EMULATED_MATH = False
- EXTRA_LINK_ARGS = []
- EXTRA_LIBRARIES = ['m'] if os.name != 'nt' else []
- EXTRA_COMPILE_ARGS = [] if os.name == 'nt' else [
- '-std=c99', '-U__GNUC_GNU_INLINE__']
- if os.name == 'nt':
- EXTRA_LINK_ARGS = ['/LTCG', '/OPT:REF', 'Advapi32.lib', 'Kernel32.lib']
- if DEBUG:
- EXTRA_LINK_ARGS += ['-debug']
- EXTRA_COMPILE_ARGS += ["-Zi", "/Od"]
- if sys.version_info < (3, 0):
- EXTRA_INCLUDE_DIRS += [join(MOD_DIR, 'src', 'common')]
-
- PCG64_DEFS = []
- # TODO: remove the unconditional forced emulation, move code from pcg64.pyx
- # to an #ifdef
- if 1 or sys.maxsize < 2 ** 32 or os.name == 'nt':
- # Force emulated mode here
- PCG_EMULATED_MATH = True
- PCG64_DEFS += [('PCG_FORCE_EMULATED_128BIT_MATH', '1')]
-
- if struct.calcsize('P') < 8:
- PCG_EMULATED_MATH = True
- defs.append(('PCG_EMULATED_MATH', int(PCG_EMULATED_MATH)))
-
- DSFMT_DEFS = [('DSFMT_MEXP', '19937')]
- if USE_SSE2:
- if os.name == 'nt':
- EXTRA_COMPILE_ARGS += ['/wd4146', '/GL']
- if struct.calcsize('P') < 8:
- EXTRA_COMPILE_ARGS += ['/arch:SSE2']
- else:
- EXTRA_COMPILE_ARGS += ['-msse2']
- DSFMT_DEFS += [('HAVE_SSE2', '1')]
-
- config.add_extension('entropy',
- sources=['entropy.c', 'src/entropy/entropy.c'],
- include_dirs=[join('randomgen', 'src', 'entropy')],
- libraries=EXTRA_LIBRARIES,
- extra_compile_args=EXTRA_COMPILE_ARGS,
- extra_link_args=EXTRA_LINK_ARGS,
- depends=[join('src', 'splitmix64', 'splitmix.h'),
- join('src', 'entropy', 'entropy.h'),
- 'entropy.pyx',
- ],
- define_macros=defs,
- )
- config.add_extension('dsfmt',
- sources=['dsfmt.c', 'src/dsfmt/dSFMT.c',
- 'src/dsfmt/dSFMT-jump.c',
- 'src/aligned_malloc/aligned_malloc.c'],
- include_dirs=[join('src', 'dsfmt')],
- libraries=EXTRA_LIBRARIES,
- extra_compile_args=EXTRA_COMPILE_ARGS,
- extra_link_args=EXTRA_LINK_ARGS,
- depends=[join('src', 'dsfmt', 'dsfmt.h'),
- 'dsfmt.pyx',
- ],
- define_macros=defs + DSFMT_DEFS,
- )
- for gen in ['mt19937']:
- # gen.pyx, src/gen/gen.c, src/gen/gen-jump.c
- config.add_extension(gen,
- sources=['{0}.c'.format(gen), 'src/{0}/{0}.c'.format(gen),
- 'src/{0}/{0}-jump.c'.format(gen)],
- include_dirs=[join('src', gen)],
- libraries=EXTRA_LIBRARIES,
- extra_compile_args=EXTRA_COMPILE_ARGS,
- extra_link_args=EXTRA_LINK_ARGS,
- depends=['%s.pyx' % gen],
- define_macros=defs,
- )
- for gen in ['philox', 'threefry', 'threefry32',
- 'xoroshiro128', 'xorshift1024', 'xoshiro256starstar',
- 'xoshiro512starstar',
- 'pcg64', 'pcg32',
- ]:
- # gen.pyx, src/gen/gen.c
- if gen == 'pcg64':
- _defs = defs + PCG64_DEFS
- else:
- _defs = defs
- config.add_extension(gen,
- sources=['{0}.c'.format(gen), 'src/{0}/{0}.c'.format(gen)],
- include_dirs=[join('src', gen)],
- libraries=EXTRA_LIBRARIES,
- extra_compile_args=EXTRA_COMPILE_ARGS,
- extra_link_args=EXTRA_LINK_ARGS,
- depends=['%s.pyx' % gen],
- define_macros=_defs,
- )
- for gen in ['common']:
- # gen.pyx
- config.add_extension(gen,
- sources=['{0}.c'.format(gen)],
- libraries=EXTRA_LIBRARIES,
- extra_compile_args=EXTRA_COMPILE_ARGS,
- extra_link_args=EXTRA_LINK_ARGS,
- depends=['%s.pyx' % gen],
- define_macros=defs,
- )
- for gen in ['generator', 'bounded_integers']:
- # gen.pyx, src/distributions/distributions.c
- config.add_extension(gen,
- sources=['{0}.c'.format(gen),
- join('src', 'distributions',
- 'distributions.c')],
- libraries=EXTRA_LIBRARIES,
- extra_compile_args=EXTRA_COMPILE_ARGS,
- extra_link_args=EXTRA_LINK_ARGS,
- depends=['%s.pyx' % gen],
- define_macros=defs,
- )
- config.add_extension('mtrand',
- sources=['mtrand.c',
- 'src/legacy/distributions-boxmuller.c',
- 'src/distributions/distributions.c' ],
- include_dirs=['.', 'legacy'],
- libraries=EXTRA_LIBRARIES,
- extra_compile_args=EXTRA_COMPILE_ARGS,
- extra_link_args=EXTRA_LINK_ARGS,
- depends=['mtrand.pyx'],
- define_macros=defs + DSFMT_DEFS,
- )
- config.add_subpackage('legacy')
- return config
-if __name__ == '__main__':
- from numpy.distutils.core import setup
- setup(configuration=configuration)
diff --git a/numpy/random/randomgen/tests/data/__init__.py b/numpy/random/randomgen/tests/data/__init__.py
deleted file mode 100644
index e69de29bb..000000000
--- a/numpy/random/randomgen/tests/data/__init__.py
+++ /dev/null
diff --git a/numpy/random/setup.py b/numpy/random/setup.py
index 481c4e380..088764791 100644
--- a/numpy/random/setup.py
+++ b/numpy/random/setup.py
@@ -46,21 +46,160 @@ def configuration(parent_package='',top_path=None):
libs = []
defs.append(('NPY_NO_DEPRECATED_API', 0))
# Configure mtrand
- config.add_extension('mtrand',
- sources=[join('mtrand', x) for x in
+ config.add_extension('_mtrand',
+ sources=[join('_mtrand', x) for x in
['mtrand.c', 'randomkit.c', 'initarray.c',
'distributions.c']]+[generate_libraries],
libraries=libs,
- depends=[join('mtrand', '*.h'),
- join('mtrand', '*.pyx'),
- join('mtrand', '*.pxi'),],
+ depends=[join('_mtrand', '*.h'),
+ join('_mtrand', '*.pyx'),
+ join('_mtrand', '*.pxi'),],
define_macros=defs,
)
- config.add_data_files(('.', join('mtrand', 'randomkit.h')))
+ config.add_data_files(('.', join('_mtrand', 'randomkit.h')))
config.add_data_dir('tests')
- config.add_subpackage('randomgen')
+ ##############################
+ # randomgen
+ ##############################
+
+ # Make a guess as to whether SSE2 is present for now, TODO: Improve
+ USE_SSE2 = False
+ for k in platform.uname():
+ for val in ('x86', 'i686', 'i386', 'amd64'):
+ USE_SSE2 = USE_SSE2 or val in k.lower()
+ print('Building with SSE?: {0}'.format(USE_SSE2))
+ if '--no-sse2' in sys.argv:
+ USE_SSE2 = False
+ sys.argv.remove('--no-sse2')
+
+ DEBUG = False
+ PCG_EMULATED_MATH = False
+ EXTRA_LINK_ARGS = []
+ EXTRA_LIBRARIES = ['m'] if os.name != 'nt' else []
+ EXTRA_COMPILE_ARGS = [] if os.name == 'nt' else [
+ '-std=c99', '-U__GNUC_GNU_INLINE__']
+ if os.name == 'nt':
+ EXTRA_LINK_ARGS = ['/LTCG', '/OPT:REF', 'Advapi32.lib', 'Kernel32.lib']
+ if DEBUG:
+ EXTRA_LINK_ARGS += ['-debug']
+ EXTRA_COMPILE_ARGS += ["-Zi", "/Od"]
+ if sys.version_info < (3, 0):
+ EXTRA_INCLUDE_DIRS += [join(MOD_DIR, 'src', 'common')]
+
+ PCG64_DEFS = []
+ # TODO: remove the unconditional forced emulation, move code from pcg64.pyx
+ # to an #ifdef
+ if 1 or sys.maxsize < 2 ** 32 or os.name == 'nt':
+ # Force emulated mode here
+ PCG_EMULATED_MATH = True
+ PCG64_DEFS += [('PCG_FORCE_EMULATED_128BIT_MATH', '1')]
+
+ if struct.calcsize('P') < 8:
+ PCG_EMULATED_MATH = True
+ defs.append(('PCG_EMULATED_MATH', int(PCG_EMULATED_MATH)))
+
+ DSFMT_DEFS = [('DSFMT_MEXP', '19937')]
+ if USE_SSE2:
+ if os.name == 'nt':
+ EXTRA_COMPILE_ARGS += ['/wd4146', '/GL']
+ if struct.calcsize('P') < 8:
+ EXTRA_COMPILE_ARGS += ['/arch:SSE2']
+ else:
+ EXTRA_COMPILE_ARGS += ['-msse2']
+ DSFMT_DEFS += [('HAVE_SSE2', '1')]
+
+ config.add_extension('entropy',
+ sources=['entropy.c', 'src/entropy/entropy.c'],
+ include_dirs=[join('randomgen', 'src', 'entropy')],
+ libraries=EXTRA_LIBRARIES,
+ extra_compile_args=EXTRA_COMPILE_ARGS,
+ extra_link_args=EXTRA_LINK_ARGS,
+ depends=[join('src', 'splitmix64', 'splitmix.h'),
+ join('src', 'entropy', 'entropy.h'),
+ 'entropy.pyx',
+ ],
+ define_macros=defs,
+ )
+ config.add_extension('dsfmt',
+ sources=['dsfmt.c', 'src/dsfmt/dSFMT.c',
+ 'src/dsfmt/dSFMT-jump.c',
+ 'src/aligned_malloc/aligned_malloc.c'],
+ include_dirs=[join('src', 'dsfmt')],
+ libraries=EXTRA_LIBRARIES,
+ extra_compile_args=EXTRA_COMPILE_ARGS,
+ extra_link_args=EXTRA_LINK_ARGS,
+ depends=[join('src', 'dsfmt', 'dsfmt.h'),
+ 'dsfmt.pyx',
+ ],
+ define_macros=defs + DSFMT_DEFS,
+ )
+ for gen in ['mt19937']:
+ # gen.pyx, src/gen/gen.c, src/gen/gen-jump.c
+ config.add_extension(gen,
+ sources=['{0}.c'.format(gen), 'src/{0}/{0}.c'.format(gen),
+ 'src/{0}/{0}-jump.c'.format(gen)],
+ include_dirs=[join('src', gen)],
+ libraries=EXTRA_LIBRARIES,
+ extra_compile_args=EXTRA_COMPILE_ARGS,
+ extra_link_args=EXTRA_LINK_ARGS,
+ depends=['%s.pyx' % gen],
+ define_macros=defs,
+ )
+ for gen in ['philox', 'threefry', 'threefry32',
+ 'xoroshiro128', 'xorshift1024', 'xoshiro256starstar',
+ 'xoshiro512starstar',
+ 'pcg64', 'pcg32',
+ ]:
+ # gen.pyx, src/gen/gen.c
+ if gen == 'pcg64':
+ _defs = defs + PCG64_DEFS
+ else:
+ _defs = defs
+ config.add_extension(gen,
+ sources=['{0}.c'.format(gen), 'src/{0}/{0}.c'.format(gen)],
+ include_dirs=[join('src', gen)],
+ libraries=EXTRA_LIBRARIES,
+ extra_compile_args=EXTRA_COMPILE_ARGS,
+ extra_link_args=EXTRA_LINK_ARGS,
+ depends=['%s.pyx' % gen],
+ define_macros=_defs,
+ )
+ for gen in ['common']:
+ # gen.pyx
+ config.add_extension(gen,
+ sources=['{0}.c'.format(gen)],
+ libraries=EXTRA_LIBRARIES,
+ extra_compile_args=EXTRA_COMPILE_ARGS,
+ extra_link_args=EXTRA_LINK_ARGS,
+ depends=['%s.pyx' % gen],
+ define_macros=defs,
+ )
+ for gen in ['generator', 'bounded_integers']:
+ # gen.pyx, src/distributions/distributions.c
+ config.add_extension(gen,
+ sources=['{0}.c'.format(gen),
+ join('src', 'distributions',
+ 'distributions.c')],
+ libraries=EXTRA_LIBRARIES,
+ extra_compile_args=EXTRA_COMPILE_ARGS,
+ extra_link_args=EXTRA_LINK_ARGS,
+ depends=['%s.pyx' % gen],
+ define_macros=defs,
+ )
+ config.add_extension('mtrand',
+ sources=['mtrand.c',
+ 'src/legacy/distributions-boxmuller.c',
+ 'src/distributions/distributions.c' ],
+ include_dirs=['.', 'legacy'],
+ libraries=EXTRA_LIBRARIES,
+ extra_compile_args=EXTRA_COMPILE_ARGS,
+ extra_link_args=EXTRA_LINK_ARGS,
+ depends=['mtrand.pyx'],
+ define_macros=defs + DSFMT_DEFS,
+ )
+ config.add_subpackage('legacy')
return config
if __name__ == '__main__':
diff --git a/numpy/random/randomgen/src/aligned_malloc/aligned_malloc.c b/numpy/random/src/aligned_malloc/aligned_malloc.c
index 6e8192cfb..6e8192cfb 100644
--- a/numpy/random/randomgen/src/aligned_malloc/aligned_malloc.c
+++ b/numpy/random/src/aligned_malloc/aligned_malloc.c
diff --git a/numpy/random/randomgen/src/aligned_malloc/aligned_malloc.h b/numpy/random/src/aligned_malloc/aligned_malloc.h
index ea24f6d23..ea24f6d23 100644
--- a/numpy/random/randomgen/src/aligned_malloc/aligned_malloc.h
+++ b/numpy/random/src/aligned_malloc/aligned_malloc.h
diff --git a/numpy/random/randomgen/src/common/LICENSE.md b/numpy/random/src/common/LICENSE.md
index 71bf8cf46..71bf8cf46 100644
--- a/numpy/random/randomgen/src/common/LICENSE.md
+++ b/numpy/random/src/common/LICENSE.md
diff --git a/numpy/random/randomgen/src/common/inttypes.h b/numpy/random/src/common/inttypes.h
index 8f8b61108..8f8b61108 100644
--- a/numpy/random/randomgen/src/common/inttypes.h
+++ b/numpy/random/src/common/inttypes.h
diff --git a/numpy/random/randomgen/src/common/stdint.h b/numpy/random/src/common/stdint.h
index 710de1570..710de1570 100644
--- a/numpy/random/randomgen/src/common/stdint.h
+++ b/numpy/random/src/common/stdint.h
diff --git a/numpy/random/randomgen/src/distributions/LICENSE.md b/numpy/random/src/distributions/LICENSE.md
index 31576ba4b..31576ba4b 100644
--- a/numpy/random/randomgen/src/distributions/LICENSE.md
+++ b/numpy/random/src/distributions/LICENSE.md
diff --git a/numpy/random/randomgen/src/distributions/binomial.h b/numpy/random/src/distributions/binomial.h
index e69de29bb..e69de29bb 100644
--- a/numpy/random/randomgen/src/distributions/binomial.h
+++ b/numpy/random/src/distributions/binomial.h
diff --git a/numpy/random/randomgen/src/distributions/distributions.c b/numpy/random/src/distributions/distributions.c
index 83806de38..83806de38 100644
--- a/numpy/random/randomgen/src/distributions/distributions.c
+++ b/numpy/random/src/distributions/distributions.c
diff --git a/numpy/random/randomgen/src/distributions/distributions.h b/numpy/random/src/distributions/distributions.h
index 7ca31a16c..7ca31a16c 100644
--- a/numpy/random/randomgen/src/distributions/distributions.h
+++ b/numpy/random/src/distributions/distributions.h
diff --git a/numpy/random/randomgen/src/distributions/ziggurat.h b/numpy/random/src/distributions/ziggurat.h
index 7808c0e68..7808c0e68 100644
--- a/numpy/random/randomgen/src/distributions/ziggurat.h
+++ b/numpy/random/src/distributions/ziggurat.h
diff --git a/numpy/random/randomgen/src/distributions/ziggurat_constants.h b/numpy/random/src/distributions/ziggurat_constants.h
index 17eccec0f..17eccec0f 100644
--- a/numpy/random/randomgen/src/distributions/ziggurat_constants.h
+++ b/numpy/random/src/distributions/ziggurat_constants.h
diff --git a/numpy/random/randomgen/src/dsfmt/128-bit-jump.poly.txt b/numpy/random/src/dsfmt/128-bit-jump.poly.txt
index fea1318fb..fea1318fb 100644
--- a/numpy/random/randomgen/src/dsfmt/128-bit-jump.poly.txt
+++ b/numpy/random/src/dsfmt/128-bit-jump.poly.txt
diff --git a/numpy/random/randomgen/src/dsfmt/96-bit-jump.poly.txt b/numpy/random/src/dsfmt/96-bit-jump.poly.txt
index 15c68d155..15c68d155 100644
--- a/numpy/random/randomgen/src/dsfmt/96-bit-jump.poly.txt
+++ b/numpy/random/src/dsfmt/96-bit-jump.poly.txt
diff --git a/numpy/random/randomgen/src/dsfmt/LICENSE.md b/numpy/random/src/dsfmt/LICENSE.md
index d59568f6b..d59568f6b 100644
--- a/numpy/random/randomgen/src/dsfmt/LICENSE.md
+++ b/numpy/random/src/dsfmt/LICENSE.md
diff --git a/numpy/random/randomgen/src/dsfmt/calc-jump.cpp b/numpy/random/src/dsfmt/calc-jump.cpp
index 495b2797c..495b2797c 100644
--- a/numpy/random/randomgen/src/dsfmt/calc-jump.cpp
+++ b/numpy/random/src/dsfmt/calc-jump.cpp
diff --git a/numpy/random/randomgen/src/dsfmt/dSFMT-benchmark.c b/numpy/random/src/dsfmt/dSFMT-benchmark.c
index af29d0e1f..af29d0e1f 100644
--- a/numpy/random/randomgen/src/dsfmt/dSFMT-benchmark.c
+++ b/numpy/random/src/dsfmt/dSFMT-benchmark.c
diff --git a/numpy/random/randomgen/src/dsfmt/dSFMT-calc-jump.hpp b/numpy/random/src/dsfmt/dSFMT-calc-jump.hpp
index b960826be..b960826be 100644
--- a/numpy/random/randomgen/src/dsfmt/dSFMT-calc-jump.hpp
+++ b/numpy/random/src/dsfmt/dSFMT-calc-jump.hpp
diff --git a/numpy/random/randomgen/src/dsfmt/dSFMT-common.h b/numpy/random/src/dsfmt/dSFMT-common.h
index 30c26c08b..30c26c08b 100644
--- a/numpy/random/randomgen/src/dsfmt/dSFMT-common.h
+++ b/numpy/random/src/dsfmt/dSFMT-common.h
diff --git a/numpy/random/randomgen/src/dsfmt/dSFMT-jump.c b/numpy/random/src/dsfmt/dSFMT-jump.c
index 1832bb885..1832bb885 100644
--- a/numpy/random/randomgen/src/dsfmt/dSFMT-jump.c
+++ b/numpy/random/src/dsfmt/dSFMT-jump.c
diff --git a/numpy/random/randomgen/src/dsfmt/dSFMT-jump.h b/numpy/random/src/dsfmt/dSFMT-jump.h
index 689f9499a..689f9499a 100644
--- a/numpy/random/randomgen/src/dsfmt/dSFMT-jump.h
+++ b/numpy/random/src/dsfmt/dSFMT-jump.h
diff --git a/numpy/random/randomgen/src/dsfmt/dSFMT-params.h b/numpy/random/src/dsfmt/dSFMT-params.h
index aa0247800..aa0247800 100644
--- a/numpy/random/randomgen/src/dsfmt/dSFMT-params.h
+++ b/numpy/random/src/dsfmt/dSFMT-params.h
diff --git a/numpy/random/randomgen/src/dsfmt/dSFMT-params19937.h b/numpy/random/src/dsfmt/dSFMT-params19937.h
index a600b0dbc..a600b0dbc 100644
--- a/numpy/random/randomgen/src/dsfmt/dSFMT-params19937.h
+++ b/numpy/random/src/dsfmt/dSFMT-params19937.h
diff --git a/numpy/random/randomgen/src/dsfmt/dSFMT-poly.h b/numpy/random/src/dsfmt/dSFMT-poly.h
index f8e15c3eb..f8e15c3eb 100644
--- a/numpy/random/randomgen/src/dsfmt/dSFMT-poly.h
+++ b/numpy/random/src/dsfmt/dSFMT-poly.h
diff --git a/numpy/random/randomgen/src/dsfmt/dSFMT-test-gen.c b/numpy/random/src/dsfmt/dSFMT-test-gen.c
index 697a3010a..697a3010a 100644
--- a/numpy/random/randomgen/src/dsfmt/dSFMT-test-gen.c
+++ b/numpy/random/src/dsfmt/dSFMT-test-gen.c
diff --git a/numpy/random/randomgen/src/dsfmt/dSFMT.c b/numpy/random/src/dsfmt/dSFMT.c
index 0f122c26c..0f122c26c 100644
--- a/numpy/random/randomgen/src/dsfmt/dSFMT.c
+++ b/numpy/random/src/dsfmt/dSFMT.c
diff --git a/numpy/random/randomgen/src/dsfmt/dSFMT.h b/numpy/random/src/dsfmt/dSFMT.h
index 224d0108f..224d0108f 100644
--- a/numpy/random/randomgen/src/dsfmt/dSFMT.h
+++ b/numpy/random/src/dsfmt/dSFMT.h
diff --git a/numpy/random/randomgen/src/entropy/LICENSE.md b/numpy/random/src/entropy/LICENSE.md
index b7276aad7..b7276aad7 100644
--- a/numpy/random/randomgen/src/entropy/LICENSE.md
+++ b/numpy/random/src/entropy/LICENSE.md
diff --git a/numpy/random/randomgen/src/entropy/entropy.c b/numpy/random/src/entropy/entropy.c
index ead4bef83..ead4bef83 100644
--- a/numpy/random/randomgen/src/entropy/entropy.c
+++ b/numpy/random/src/entropy/entropy.c
diff --git a/numpy/random/randomgen/src/entropy/entropy.h b/numpy/random/src/entropy/entropy.h
index 785603dd3..785603dd3 100644
--- a/numpy/random/randomgen/src/entropy/entropy.h
+++ b/numpy/random/src/entropy/entropy.h
diff --git a/numpy/random/randomgen/src/legacy/LICENSE.md b/numpy/random/src/legacy/LICENSE.md
index 88b1791b2..88b1791b2 100644
--- a/numpy/random/randomgen/src/legacy/LICENSE.md
+++ b/numpy/random/src/legacy/LICENSE.md
diff --git a/numpy/random/randomgen/src/legacy/distributions-boxmuller.c b/numpy/random/src/legacy/distributions-boxmuller.c
index 5d3ba27f8..5d3ba27f8 100644
--- a/numpy/random/randomgen/src/legacy/distributions-boxmuller.c
+++ b/numpy/random/src/legacy/distributions-boxmuller.c
diff --git a/numpy/random/randomgen/src/legacy/distributions-boxmuller.h b/numpy/random/src/legacy/distributions-boxmuller.h
index 445686e6c..445686e6c 100644
--- a/numpy/random/randomgen/src/legacy/distributions-boxmuller.h
+++ b/numpy/random/src/legacy/distributions-boxmuller.h
diff --git a/numpy/random/randomgen/src/mt19937/LICENSE.md b/numpy/random/src/mt19937/LICENSE.md
index f65c3d46e..f65c3d46e 100644
--- a/numpy/random/randomgen/src/mt19937/LICENSE.md
+++ b/numpy/random/src/mt19937/LICENSE.md
diff --git a/numpy/random/randomgen/src/mt19937/mt19937-benchmark.c b/numpy/random/src/mt19937/mt19937-benchmark.c
index 039f8030a..039f8030a 100644
--- a/numpy/random/randomgen/src/mt19937/mt19937-benchmark.c
+++ b/numpy/random/src/mt19937/mt19937-benchmark.c
diff --git a/numpy/random/randomgen/src/mt19937/mt19937-jump.c b/numpy/random/src/mt19937/mt19937-jump.c
index 46b28cf96..46b28cf96 100644
--- a/numpy/random/randomgen/src/mt19937/mt19937-jump.c
+++ b/numpy/random/src/mt19937/mt19937-jump.c
diff --git a/numpy/random/randomgen/src/mt19937/mt19937-jump.h b/numpy/random/src/mt19937/mt19937-jump.h
index 394c150a0..394c150a0 100644
--- a/numpy/random/randomgen/src/mt19937/mt19937-jump.h
+++ b/numpy/random/src/mt19937/mt19937-jump.h
diff --git a/numpy/random/randomgen/src/mt19937/mt19937-poly.h b/numpy/random/src/mt19937/mt19937-poly.h
index b03747881..b03747881 100644
--- a/numpy/random/randomgen/src/mt19937/mt19937-poly.h
+++ b/numpy/random/src/mt19937/mt19937-poly.h
diff --git a/numpy/random/randomgen/src/mt19937/mt19937-test-data-gen.c b/numpy/random/src/mt19937/mt19937-test-data-gen.c
index 4f4ec1d64..4f4ec1d64 100644
--- a/numpy/random/randomgen/src/mt19937/mt19937-test-data-gen.c
+++ b/numpy/random/src/mt19937/mt19937-test-data-gen.c
diff --git a/numpy/random/randomgen/src/mt19937/mt19937.c b/numpy/random/src/mt19937/mt19937.c
index e5ca9e0cf..e5ca9e0cf 100644
--- a/numpy/random/randomgen/src/mt19937/mt19937.c
+++ b/numpy/random/src/mt19937/mt19937.c
diff --git a/numpy/random/randomgen/src/mt19937/mt19937.h b/numpy/random/src/mt19937/mt19937.h
index 8105329ec..8105329ec 100644
--- a/numpy/random/randomgen/src/mt19937/mt19937.h
+++ b/numpy/random/src/mt19937/mt19937.h
diff --git a/numpy/random/randomgen/src/mt19937/randomkit.c b/numpy/random/src/mt19937/randomkit.c
index f8ed4b49e..f8ed4b49e 100644
--- a/numpy/random/randomgen/src/mt19937/randomkit.c
+++ b/numpy/random/src/mt19937/randomkit.c
diff --git a/numpy/random/randomgen/src/mt19937/randomkit.h b/numpy/random/src/mt19937/randomkit.h
index abb082cb2..abb082cb2 100644
--- a/numpy/random/randomgen/src/mt19937/randomkit.h
+++ b/numpy/random/src/mt19937/randomkit.h
diff --git a/numpy/random/randomgen/src/pcg32/LICENSE.md b/numpy/random/src/pcg32/LICENSE.md
index 3db2ac2e8..3db2ac2e8 100644
--- a/numpy/random/randomgen/src/pcg32/LICENSE.md
+++ b/numpy/random/src/pcg32/LICENSE.md
diff --git a/numpy/random/randomgen/src/pcg32/pcg-advance-64.c b/numpy/random/src/pcg32/pcg-advance-64.c
index 8210e7565..8210e7565 100644
--- a/numpy/random/randomgen/src/pcg32/pcg-advance-64.c
+++ b/numpy/random/src/pcg32/pcg-advance-64.c
diff --git a/numpy/random/randomgen/src/pcg32/pcg32-test-data-gen.c b/numpy/random/src/pcg32/pcg32-test-data-gen.c
index cccaf84b9..cccaf84b9 100644
--- a/numpy/random/randomgen/src/pcg32/pcg32-test-data-gen.c
+++ b/numpy/random/src/pcg32/pcg32-test-data-gen.c
diff --git a/numpy/random/randomgen/src/pcg32/pcg32.c b/numpy/random/src/pcg32/pcg32.c
index 5fbf6759f..5fbf6759f 100644
--- a/numpy/random/randomgen/src/pcg32/pcg32.c
+++ b/numpy/random/src/pcg32/pcg32.c
diff --git a/numpy/random/randomgen/src/pcg32/pcg32.h b/numpy/random/src/pcg32/pcg32.h
index 557113d8f..557113d8f 100644
--- a/numpy/random/randomgen/src/pcg32/pcg32.h
+++ b/numpy/random/src/pcg32/pcg32.h
diff --git a/numpy/random/randomgen/src/pcg32/pcg_variants.h b/numpy/random/src/pcg32/pcg_variants.h
index 32daac1ce..32daac1ce 100644
--- a/numpy/random/randomgen/src/pcg32/pcg_variants.h
+++ b/numpy/random/src/pcg32/pcg_variants.h
diff --git a/numpy/random/randomgen/src/pcg64/LICENSE.md b/numpy/random/src/pcg64/LICENSE.md
index dd6a17ee8..dd6a17ee8 100644
--- a/numpy/random/randomgen/src/pcg64/LICENSE.md
+++ b/numpy/random/src/pcg64/LICENSE.md
diff --git a/numpy/random/randomgen/src/pcg64/pcg64-benchmark.c b/numpy/random/src/pcg64/pcg64-benchmark.c
index 76f3ec78c..76f3ec78c 100644
--- a/numpy/random/randomgen/src/pcg64/pcg64-benchmark.c
+++ b/numpy/random/src/pcg64/pcg64-benchmark.c
diff --git a/numpy/random/randomgen/src/pcg64/pcg64-test-data-gen.c b/numpy/random/src/pcg64/pcg64-test-data-gen.c
index 0c2b079a3..0c2b079a3 100644
--- a/numpy/random/randomgen/src/pcg64/pcg64-test-data-gen.c
+++ b/numpy/random/src/pcg64/pcg64-test-data-gen.c
diff --git a/numpy/random/randomgen/src/pcg64/pcg64.c b/numpy/random/src/pcg64/pcg64.c
index c7c1eb045..c7c1eb045 100644
--- a/numpy/random/randomgen/src/pcg64/pcg64.c
+++ b/numpy/random/src/pcg64/pcg64.c
diff --git a/numpy/random/randomgen/src/pcg64/pcg64.h b/numpy/random/src/pcg64/pcg64.h
index 156c73a36..156c73a36 100644
--- a/numpy/random/randomgen/src/pcg64/pcg64.h
+++ b/numpy/random/src/pcg64/pcg64.h
diff --git a/numpy/random/randomgen/src/pcg64/pcg64.orig.c b/numpy/random/src/pcg64/pcg64.orig.c
index 07e97e4b6..07e97e4b6 100644
--- a/numpy/random/randomgen/src/pcg64/pcg64.orig.c
+++ b/numpy/random/src/pcg64/pcg64.orig.c
diff --git a/numpy/random/randomgen/src/pcg64/pcg64.orig.h b/numpy/random/src/pcg64/pcg64.orig.h
index 74be91f31..74be91f31 100644
--- a/numpy/random/randomgen/src/pcg64/pcg64.orig.h
+++ b/numpy/random/src/pcg64/pcg64.orig.h
diff --git a/numpy/random/randomgen/src/philox/LICENSE.md b/numpy/random/src/philox/LICENSE.md
index 4a9f6bb29..4a9f6bb29 100644
--- a/numpy/random/randomgen/src/philox/LICENSE.md
+++ b/numpy/random/src/philox/LICENSE.md
diff --git a/numpy/random/randomgen/src/philox/philox-benchmark.c b/numpy/random/src/philox/philox-benchmark.c
index 0cab04cf5..0cab04cf5 100644
--- a/numpy/random/randomgen/src/philox/philox-benchmark.c
+++ b/numpy/random/src/philox/philox-benchmark.c
diff --git a/numpy/random/randomgen/src/philox/philox-test-data-gen.c b/numpy/random/src/philox/philox-test-data-gen.c
index 442e18b55..442e18b55 100644
--- a/numpy/random/randomgen/src/philox/philox-test-data-gen.c
+++ b/numpy/random/src/philox/philox-test-data-gen.c
diff --git a/numpy/random/randomgen/src/philox/philox.c b/numpy/random/src/philox/philox.c
index 3382c60d6..3382c60d6 100644
--- a/numpy/random/randomgen/src/philox/philox.c
+++ b/numpy/random/src/philox/philox.c
diff --git a/numpy/random/randomgen/src/philox/philox.h b/numpy/random/src/philox/philox.h
index 411404b55..411404b55 100644
--- a/numpy/random/randomgen/src/philox/philox.h
+++ b/numpy/random/src/philox/philox.h
diff --git a/numpy/random/randomgen/src/splitmix64/LICENSE.md b/numpy/random/src/splitmix64/LICENSE.md
index 3c4d73b92..3c4d73b92 100644
--- a/numpy/random/randomgen/src/splitmix64/LICENSE.md
+++ b/numpy/random/src/splitmix64/LICENSE.md
diff --git a/numpy/random/randomgen/src/splitmix64/splitmix64.c b/numpy/random/src/splitmix64/splitmix64.c
index 79a845982..79a845982 100644
--- a/numpy/random/randomgen/src/splitmix64/splitmix64.c
+++ b/numpy/random/src/splitmix64/splitmix64.c
diff --git a/numpy/random/randomgen/src/splitmix64/splitmix64.h b/numpy/random/src/splitmix64/splitmix64.h
index 880132970..880132970 100644
--- a/numpy/random/randomgen/src/splitmix64/splitmix64.h
+++ b/numpy/random/src/splitmix64/splitmix64.h
diff --git a/numpy/random/randomgen/src/splitmix64/splitmix64.orig.c b/numpy/random/src/splitmix64/splitmix64.orig.c
index df6133aab..df6133aab 100644
--- a/numpy/random/randomgen/src/splitmix64/splitmix64.orig.c
+++ b/numpy/random/src/splitmix64/splitmix64.orig.c
diff --git a/numpy/random/randomgen/src/threefry/LICENSE.md b/numpy/random/src/threefry/LICENSE.md
index 4a9f6bb29..4a9f6bb29 100644
--- a/numpy/random/randomgen/src/threefry/LICENSE.md
+++ b/numpy/random/src/threefry/LICENSE.md
diff --git a/numpy/random/randomgen/src/threefry/threefry-benchmark.c b/numpy/random/src/threefry/threefry-benchmark.c
index 6d6239cd3..6d6239cd3 100644
--- a/numpy/random/randomgen/src/threefry/threefry-benchmark.c
+++ b/numpy/random/src/threefry/threefry-benchmark.c
diff --git a/numpy/random/randomgen/src/threefry/threefry-orig.c b/numpy/random/src/threefry/threefry-orig.c
index d27cfd797..d27cfd797 100644
--- a/numpy/random/randomgen/src/threefry/threefry-orig.c
+++ b/numpy/random/src/threefry/threefry-orig.c
diff --git a/numpy/random/randomgen/src/threefry/threefry-test-data-gen.c b/numpy/random/src/threefry/threefry-test-data-gen.c
index 328eb2575..328eb2575 100644
--- a/numpy/random/randomgen/src/threefry/threefry-test-data-gen.c
+++ b/numpy/random/src/threefry/threefry-test-data-gen.c
diff --git a/numpy/random/randomgen/src/threefry/threefry.c b/numpy/random/src/threefry/threefry.c
index 19c37df1b..19c37df1b 100644
--- a/numpy/random/randomgen/src/threefry/threefry.c
+++ b/numpy/random/src/threefry/threefry.c
diff --git a/numpy/random/randomgen/src/threefry/threefry.h b/numpy/random/src/threefry/threefry.h
index 297c1241a..297c1241a 100644
--- a/numpy/random/randomgen/src/threefry/threefry.h
+++ b/numpy/random/src/threefry/threefry.h
diff --git a/numpy/random/randomgen/src/threefry32/LICENSE.md b/numpy/random/src/threefry32/LICENSE.md
index 591cd75f4..591cd75f4 100644
--- a/numpy/random/randomgen/src/threefry32/LICENSE.md
+++ b/numpy/random/src/threefry32/LICENSE.md
diff --git a/numpy/random/randomgen/src/threefry32/threefry32-test-data-gen.c b/numpy/random/src/threefry32/threefry32-test-data-gen.c
index 0e6229995..0e6229995 100644
--- a/numpy/random/randomgen/src/threefry32/threefry32-test-data-gen.c
+++ b/numpy/random/src/threefry32/threefry32-test-data-gen.c
diff --git a/numpy/random/randomgen/src/threefry32/threefry32.c b/numpy/random/src/threefry32/threefry32.c
index 500e9482d..500e9482d 100644
--- a/numpy/random/randomgen/src/threefry32/threefry32.c
+++ b/numpy/random/src/threefry32/threefry32.c
diff --git a/numpy/random/randomgen/src/threefry32/threefry32.h b/numpy/random/src/threefry32/threefry32.h
index 74a85c42b..74a85c42b 100644
--- a/numpy/random/randomgen/src/threefry32/threefry32.h
+++ b/numpy/random/src/threefry32/threefry32.h
diff --git a/numpy/random/randomgen/src/xoroshiro128/LICENSE.md b/numpy/random/src/xoroshiro128/LICENSE.md
index 969430149..969430149 100644
--- a/numpy/random/randomgen/src/xoroshiro128/LICENSE.md
+++ b/numpy/random/src/xoroshiro128/LICENSE.md
diff --git a/numpy/random/randomgen/src/xoroshiro128/xoroshiro128-benchmark.c b/numpy/random/src/xoroshiro128/xoroshiro128-benchmark.c
index 9a7b52bfb..9a7b52bfb 100644
--- a/numpy/random/randomgen/src/xoroshiro128/xoroshiro128-benchmark.c
+++ b/numpy/random/src/xoroshiro128/xoroshiro128-benchmark.c
diff --git a/numpy/random/randomgen/src/xoroshiro128/xoroshiro128-test-data-gen.c b/numpy/random/src/xoroshiro128/xoroshiro128-test-data-gen.c
index d50e63f5e..d50e63f5e 100644
--- a/numpy/random/randomgen/src/xoroshiro128/xoroshiro128-test-data-gen.c
+++ b/numpy/random/src/xoroshiro128/xoroshiro128-test-data-gen.c
diff --git a/numpy/random/randomgen/src/xoroshiro128/xoroshiro128.c b/numpy/random/src/xoroshiro128/xoroshiro128.c
index 060eb8a51..060eb8a51 100644
--- a/numpy/random/randomgen/src/xoroshiro128/xoroshiro128.c
+++ b/numpy/random/src/xoroshiro128/xoroshiro128.c
diff --git a/numpy/random/randomgen/src/xoroshiro128/xoroshiro128.h b/numpy/random/src/xoroshiro128/xoroshiro128.h
index 0db82b173..0db82b173 100644
--- a/numpy/random/randomgen/src/xoroshiro128/xoroshiro128.h
+++ b/numpy/random/src/xoroshiro128/xoroshiro128.h
diff --git a/numpy/random/randomgen/src/xoroshiro128/xoroshiro128plus.orig.c b/numpy/random/src/xoroshiro128/xoroshiro128plus.orig.c
index 1b5f46e4b..1b5f46e4b 100644
--- a/numpy/random/randomgen/src/xoroshiro128/xoroshiro128plus.orig.c
+++ b/numpy/random/src/xoroshiro128/xoroshiro128plus.orig.c
diff --git a/numpy/random/randomgen/src/xoroshiro128/xoroshiro128plus.orig.h b/numpy/random/src/xoroshiro128/xoroshiro128plus.orig.h
index 20c96fe04..20c96fe04 100644
--- a/numpy/random/randomgen/src/xoroshiro128/xoroshiro128plus.orig.h
+++ b/numpy/random/src/xoroshiro128/xoroshiro128plus.orig.h
diff --git a/numpy/random/randomgen/src/xorshift1024/LICENSE.md b/numpy/random/src/xorshift1024/LICENSE.md
index 3ca8ed4b9..3ca8ed4b9 100644
--- a/numpy/random/randomgen/src/xorshift1024/LICENSE.md
+++ b/numpy/random/src/xorshift1024/LICENSE.md
diff --git a/numpy/random/randomgen/src/xorshift1024/xorshift1024-benchmark.c b/numpy/random/src/xorshift1024/xorshift1024-benchmark.c
index 0eef33537..0eef33537 100644
--- a/numpy/random/randomgen/src/xorshift1024/xorshift1024-benchmark.c
+++ b/numpy/random/src/xorshift1024/xorshift1024-benchmark.c
diff --git a/numpy/random/randomgen/src/xorshift1024/xorshift1024-test-data-gen.c b/numpy/random/src/xorshift1024/xorshift1024-test-data-gen.c
index a2ae08df4..a2ae08df4 100644
--- a/numpy/random/randomgen/src/xorshift1024/xorshift1024-test-data-gen.c
+++ b/numpy/random/src/xorshift1024/xorshift1024-test-data-gen.c
diff --git a/numpy/random/randomgen/src/xorshift1024/xorshift1024.c b/numpy/random/src/xorshift1024/xorshift1024.c
index 8737b5a82..8737b5a82 100644
--- a/numpy/random/randomgen/src/xorshift1024/xorshift1024.c
+++ b/numpy/random/src/xorshift1024/xorshift1024.c
diff --git a/numpy/random/randomgen/src/xorshift1024/xorshift1024.h b/numpy/random/src/xorshift1024/xorshift1024.h
index e0ef77826..e0ef77826 100644
--- a/numpy/random/randomgen/src/xorshift1024/xorshift1024.h
+++ b/numpy/random/src/xorshift1024/xorshift1024.h
diff --git a/numpy/random/randomgen/src/xorshift1024/xorshift1024.orig.c b/numpy/random/src/xorshift1024/xorshift1024.orig.c
index 03c1c17fe..03c1c17fe 100644
--- a/numpy/random/randomgen/src/xorshift1024/xorshift1024.orig.c
+++ b/numpy/random/src/xorshift1024/xorshift1024.orig.c
diff --git a/numpy/random/randomgen/src/xorshift1024/xorshift1024.orig.h b/numpy/random/src/xorshift1024/xorshift1024.orig.h
index 9b7597967..9b7597967 100644
--- a/numpy/random/randomgen/src/xorshift1024/xorshift1024.orig.h
+++ b/numpy/random/src/xorshift1024/xorshift1024.orig.h
diff --git a/numpy/random/randomgen/src/xoshiro256starstar/LICENSE.md b/numpy/random/src/xoshiro256starstar/LICENSE.md
index d863f3b29..d863f3b29 100644
--- a/numpy/random/randomgen/src/xoshiro256starstar/LICENSE.md
+++ b/numpy/random/src/xoshiro256starstar/LICENSE.md
diff --git a/numpy/random/randomgen/src/xoshiro256starstar/xoshiro256starstar-test-data-gen.c b/numpy/random/src/xoshiro256starstar/xoshiro256starstar-test-data-gen.c
index 8522229dd..8522229dd 100644
--- a/numpy/random/randomgen/src/xoshiro256starstar/xoshiro256starstar-test-data-gen.c
+++ b/numpy/random/src/xoshiro256starstar/xoshiro256starstar-test-data-gen.c
diff --git a/numpy/random/randomgen/src/xoshiro256starstar/xoshiro256starstar.c b/numpy/random/src/xoshiro256starstar/xoshiro256starstar.c
index 30b6c7d85..30b6c7d85 100644
--- a/numpy/random/randomgen/src/xoshiro256starstar/xoshiro256starstar.c
+++ b/numpy/random/src/xoshiro256starstar/xoshiro256starstar.c
diff --git a/numpy/random/randomgen/src/xoshiro256starstar/xoshiro256starstar.h b/numpy/random/src/xoshiro256starstar/xoshiro256starstar.h
index 1d7d8ea40..1d7d8ea40 100644
--- a/numpy/random/randomgen/src/xoshiro256starstar/xoshiro256starstar.h
+++ b/numpy/random/src/xoshiro256starstar/xoshiro256starstar.h
diff --git a/numpy/random/randomgen/src/xoshiro256starstar/xoshiro256starstar.orig.c b/numpy/random/src/xoshiro256starstar/xoshiro256starstar.orig.c
index ecf87bab9..ecf87bab9 100644
--- a/numpy/random/randomgen/src/xoshiro256starstar/xoshiro256starstar.orig.c
+++ b/numpy/random/src/xoshiro256starstar/xoshiro256starstar.orig.c
diff --git a/numpy/random/randomgen/src/xoshiro256starstar/xoshiro256starstar.orig.h b/numpy/random/src/xoshiro256starstar/xoshiro256starstar.orig.h
index 3aa788ec9..3aa788ec9 100644
--- a/numpy/random/randomgen/src/xoshiro256starstar/xoshiro256starstar.orig.h
+++ b/numpy/random/src/xoshiro256starstar/xoshiro256starstar.orig.h
diff --git a/numpy/random/randomgen/src/xoshiro512starstar/LICENSE.md b/numpy/random/src/xoshiro512starstar/LICENSE.md
index aa34c1966..aa34c1966 100644
--- a/numpy/random/randomgen/src/xoshiro512starstar/LICENSE.md
+++ b/numpy/random/src/xoshiro512starstar/LICENSE.md
diff --git a/numpy/random/randomgen/src/xoshiro512starstar/xoshiro512starstar-test-data-gen.c b/numpy/random/src/xoshiro512starstar/xoshiro512starstar-test-data-gen.c
index bcc3574e4..bcc3574e4 100644
--- a/numpy/random/randomgen/src/xoshiro512starstar/xoshiro512starstar-test-data-gen.c
+++ b/numpy/random/src/xoshiro512starstar/xoshiro512starstar-test-data-gen.c
diff --git a/numpy/random/randomgen/src/xoshiro512starstar/xoshiro512starstar.c b/numpy/random/src/xoshiro512starstar/xoshiro512starstar.c
index a9f56699f..a9f56699f 100644
--- a/numpy/random/randomgen/src/xoshiro512starstar/xoshiro512starstar.c
+++ b/numpy/random/src/xoshiro512starstar/xoshiro512starstar.c
diff --git a/numpy/random/randomgen/src/xoshiro512starstar/xoshiro512starstar.h b/numpy/random/src/xoshiro512starstar/xoshiro512starstar.h
index 0fa0ba3cd..0fa0ba3cd 100644
--- a/numpy/random/randomgen/src/xoshiro512starstar/xoshiro512starstar.h
+++ b/numpy/random/src/xoshiro512starstar/xoshiro512starstar.h
diff --git a/numpy/random/randomgen/src/xoshiro512starstar/xoshiro512starstar.orig.c b/numpy/random/src/xoshiro512starstar/xoshiro512starstar.orig.c
index 0cf884edb..0cf884edb 100644
--- a/numpy/random/randomgen/src/xoshiro512starstar/xoshiro512starstar.orig.c
+++ b/numpy/random/src/xoshiro512starstar/xoshiro512starstar.orig.c
diff --git a/numpy/random/randomgen/src/xoshiro512starstar/xoshiro512starstar.orig.h b/numpy/random/src/xoshiro512starstar/xoshiro512starstar.orig.h
index 0b7892473..0b7892473 100644
--- a/numpy/random/randomgen/src/xoshiro512starstar/xoshiro512starstar.orig.h
+++ b/numpy/random/src/xoshiro512starstar/xoshiro512starstar.orig.h
diff --git a/numpy/random/randomgen/tests/__init__.py b/numpy/random/tests/data/__init__.py
index e69de29bb..e69de29bb 100644
--- a/numpy/random/randomgen/tests/__init__.py
+++ b/numpy/random/tests/data/__init__.py
diff --git a/numpy/random/randomgen/tests/data/dSFMT-testset-1.csv b/numpy/random/tests/data/dSFMT-testset-1.csv
index 9f3f68aee..9f3f68aee 100644
--- a/numpy/random/randomgen/tests/data/dSFMT-testset-1.csv
+++ b/numpy/random/tests/data/dSFMT-testset-1.csv
diff --git a/numpy/random/randomgen/tests/data/dSFMT-testset-2.csv b/numpy/random/tests/data/dSFMT-testset-2.csv
index 2ec2d7a51..2ec2d7a51 100644
--- a/numpy/random/randomgen/tests/data/dSFMT-testset-2.csv
+++ b/numpy/random/tests/data/dSFMT-testset-2.csv
diff --git a/numpy/random/randomgen/tests/data/mt19937-testset-1.csv b/numpy/random/tests/data/mt19937-testset-1.csv
index 3d4995840..3d4995840 100644
--- a/numpy/random/randomgen/tests/data/mt19937-testset-1.csv
+++ b/numpy/random/tests/data/mt19937-testset-1.csv
diff --git a/numpy/random/randomgen/tests/data/mt19937-testset-2.csv b/numpy/random/tests/data/mt19937-testset-2.csv
index d2f6c156c..d2f6c156c 100644
--- a/numpy/random/randomgen/tests/data/mt19937-testset-2.csv
+++ b/numpy/random/tests/data/mt19937-testset-2.csv
diff --git a/numpy/random/randomgen/tests/data/pcg32-testset-1.csv b/numpy/random/tests/data/pcg32-testset-1.csv
index 6bddc8d5c..6bddc8d5c 100644
--- a/numpy/random/randomgen/tests/data/pcg32-testset-1.csv
+++ b/numpy/random/tests/data/pcg32-testset-1.csv
diff --git a/numpy/random/randomgen/tests/data/pcg32-testset-2.csv b/numpy/random/tests/data/pcg32-testset-2.csv
index 2d4c8aed1..2d4c8aed1 100644
--- a/numpy/random/randomgen/tests/data/pcg32-testset-2.csv
+++ b/numpy/random/tests/data/pcg32-testset-2.csv
diff --git a/numpy/random/randomgen/tests/data/pcg64-testset-1.csv b/numpy/random/tests/data/pcg64-testset-1.csv
index da6d77d40..da6d77d40 100644
--- a/numpy/random/randomgen/tests/data/pcg64-testset-1.csv
+++ b/numpy/random/tests/data/pcg64-testset-1.csv
diff --git a/numpy/random/randomgen/tests/data/pcg64-testset-2.csv b/numpy/random/tests/data/pcg64-testset-2.csv
index 779761d0f..779761d0f 100644
--- a/numpy/random/randomgen/tests/data/pcg64-testset-2.csv
+++ b/numpy/random/tests/data/pcg64-testset-2.csv
diff --git a/numpy/random/randomgen/tests/data/philox-testset-1.csv b/numpy/random/tests/data/philox-testset-1.csv
index 64c1516cb..64c1516cb 100644
--- a/numpy/random/randomgen/tests/data/philox-testset-1.csv
+++ b/numpy/random/tests/data/philox-testset-1.csv
diff --git a/numpy/random/randomgen/tests/data/philox-testset-2.csv b/numpy/random/tests/data/philox-testset-2.csv
index 1c2d4eba0..1c2d4eba0 100644
--- a/numpy/random/randomgen/tests/data/philox-testset-2.csv
+++ b/numpy/random/tests/data/philox-testset-2.csv
diff --git a/numpy/random/randomgen/tests/data/threefry-testset-1.csv b/numpy/random/tests/data/threefry-testset-1.csv
index ddfa736dc..ddfa736dc 100644
--- a/numpy/random/randomgen/tests/data/threefry-testset-1.csv
+++ b/numpy/random/tests/data/threefry-testset-1.csv
diff --git a/numpy/random/randomgen/tests/data/threefry-testset-2.csv b/numpy/random/tests/data/threefry-testset-2.csv
index 275604557..275604557 100644
--- a/numpy/random/randomgen/tests/data/threefry-testset-2.csv
+++ b/numpy/random/tests/data/threefry-testset-2.csv
diff --git a/numpy/random/randomgen/tests/data/threefry32-testset-1.csv b/numpy/random/tests/data/threefry32-testset-1.csv
index 3aec7304d..3aec7304d 100644
--- a/numpy/random/randomgen/tests/data/threefry32-testset-1.csv
+++ b/numpy/random/tests/data/threefry32-testset-1.csv
diff --git a/numpy/random/randomgen/tests/data/threefry32-testset-2.csv b/numpy/random/tests/data/threefry32-testset-2.csv
index b7753638f..b7753638f 100644
--- a/numpy/random/randomgen/tests/data/threefry32-testset-2.csv
+++ b/numpy/random/tests/data/threefry32-testset-2.csv
diff --git a/numpy/random/randomgen/tests/data/xoroshiro128-testset-1.csv b/numpy/random/tests/data/xoroshiro128-testset-1.csv
index 4ef7172e1..4ef7172e1 100644
--- a/numpy/random/randomgen/tests/data/xoroshiro128-testset-1.csv
+++ b/numpy/random/tests/data/xoroshiro128-testset-1.csv
diff --git a/numpy/random/randomgen/tests/data/xoroshiro128-testset-2.csv b/numpy/random/tests/data/xoroshiro128-testset-2.csv
index 2de341ecd..2de341ecd 100644
--- a/numpy/random/randomgen/tests/data/xoroshiro128-testset-2.csv
+++ b/numpy/random/tests/data/xoroshiro128-testset-2.csv
diff --git a/numpy/random/randomgen/tests/data/xorshift1024-testset-1.csv b/numpy/random/tests/data/xorshift1024-testset-1.csv
index 661b157b1..661b157b1 100644
--- a/numpy/random/randomgen/tests/data/xorshift1024-testset-1.csv
+++ b/numpy/random/tests/data/xorshift1024-testset-1.csv
diff --git a/numpy/random/randomgen/tests/data/xorshift1024-testset-2.csv b/numpy/random/tests/data/xorshift1024-testset-2.csv
index ef10e6872..ef10e6872 100644
--- a/numpy/random/randomgen/tests/data/xorshift1024-testset-2.csv
+++ b/numpy/random/tests/data/xorshift1024-testset-2.csv
diff --git a/numpy/random/randomgen/tests/data/xoshiro256starstar-testset-1.csv b/numpy/random/tests/data/xoshiro256starstar-testset-1.csv
index 534799b04..534799b04 100644
--- a/numpy/random/randomgen/tests/data/xoshiro256starstar-testset-1.csv
+++ b/numpy/random/tests/data/xoshiro256starstar-testset-1.csv
diff --git a/numpy/random/randomgen/tests/data/xoshiro256starstar-testset-2.csv b/numpy/random/tests/data/xoshiro256starstar-testset-2.csv
index b688fcb2a..b688fcb2a 100644
--- a/numpy/random/randomgen/tests/data/xoshiro256starstar-testset-2.csv
+++ b/numpy/random/tests/data/xoshiro256starstar-testset-2.csv
diff --git a/numpy/random/randomgen/tests/data/xoshiro512starstar-testset-1.csv b/numpy/random/tests/data/xoshiro512starstar-testset-1.csv
index 78fb903ee..78fb903ee 100644
--- a/numpy/random/randomgen/tests/data/xoshiro512starstar-testset-1.csv
+++ b/numpy/random/tests/data/xoshiro512starstar-testset-1.csv
diff --git a/numpy/random/randomgen/tests/data/xoshiro512starstar-testset-2.csv b/numpy/random/tests/data/xoshiro512starstar-testset-2.csv
index 264308f1a..264308f1a 100644
--- a/numpy/random/randomgen/tests/data/xoshiro512starstar-testset-2.csv
+++ b/numpy/random/tests/data/xoshiro512starstar-testset-2.csv
diff --git a/numpy/random/randomgen/tests/test_against_numpy.py b/numpy/random/tests/test_against_numpy.py
index 431c7bd85..b930fcbff 100644
--- a/numpy/random/randomgen/tests/test_against_numpy.py
+++ b/numpy/random/tests/test_against_numpy.py
@@ -5,7 +5,7 @@ from numpy.testing import (assert_allclose, assert_array_equal, assert_equal,
import pytest
-from numpy.random.randomgen import RandomGenerator, MT19937, generator
+from numpy.random import RandomGenerator, MT19937, generator
from numpy.random import RandomState
@@ -98,12 +98,12 @@ class TestAgainstNumPy(object):
cls.rg = RandomGenerator(cls.brng(*cls.seed))
cls.rs = RandomState(cls.brng(*cls.seed))
cls.nprs = cls.np.RandomState(*cls.seed)
- cls.initial_state = cls.rg.state
+ cls.initial_state = cls.rg.brng.state
cls._set_common_state()
@classmethod
def _set_common_state(cls):
- state = cls.rg.state
+ state = cls.rg.brng.state
st = [[]] * 5
st[0] = 'MT19937'
st[1] = state['state']['key']
@@ -125,7 +125,7 @@ class TestAgainstNumPy(object):
def _is_state_common(self):
state = self.nprs.get_state()
- state2 = self.rg.state
+ state2 = self.rg.brng.state
assert (state[1] == state2['state']['key']).all()
assert (state[2] == state2['state']['pos'])
@@ -138,10 +138,10 @@ class TestAgainstNumPy(object):
assert_allclose(state[4], state2['gauss'], atol=1e-10)
def test_common_seed(self):
- self.rg.seed(1234)
+ self.rg.brng.seed(1234)
self.nprs.seed(1234)
self._is_state_common()
- self.rg.seed(23456)
+ self.rg.brng.seed(23456)
self.nprs.seed(23456)
self._is_state_common()
@@ -149,8 +149,8 @@ class TestAgainstNumPy(object):
nprs = np.random.RandomState()
nprs.standard_normal(99)
state = nprs.get_state()
- self.rg.state = state
- state2 = self.rg.state
+ self.rg.brng.state = state
+ state2 = self.rg.brng.state
assert (state[1] == state2['state']['key']).all()
assert (state[2] == state2['state']['pos'])
@@ -383,7 +383,7 @@ class TestAgainstNumPy(object):
assert_equal(s1.randint(1000), 419)
assert_equal(s1.randint(1000), s.randint(1000))
- self.rg.seed(4294967295)
+ self.rg.brng.seed(4294967295)
self.nprs.seed(4294967295)
self._is_state_common()
@@ -400,26 +400,6 @@ class TestAgainstNumPy(object):
s = RandomGenerator(MT19937([4294967295]))
assert_equal(s.randint(1000), 265)
- def test_dir(self):
- nprs_d = set(dir(self.nprs))
- rs_d = dir(self.rg)
- excluded = {'get_state', 'set_state'}
- nprs_d.difference_update(excluded)
- assert (len(nprs_d.difference(rs_d)) == 0)
-
- npmod = dir(numpy.random)
- mod = dir(generator)
- known_exlcuded = ['__all__', '__cached__', '__path__', 'Tester',
- 'info', 'bench', '__RandomState_ctor', 'mtrand',
- 'test', '__warningregistry__', '_numpy_tester',
- 'division', 'get_state', 'set_state', 'seed',
- 'ranf', 'random', 'sample', 'absolute_import',
- 'print_function', 'RandomState', 'randomgen',
- 'tests', 'Lock']
- mod += known_exlcuded
- diff = set(npmod).difference(mod)
- assert_equal(len(diff), 0)
-
# Tests using legacy generator
def test_chisquare(self):
self._set_common_state_legacy()
diff --git a/numpy/random/randomgen/tests/test_direct.py b/numpy/random/tests/test_direct.py
index 22fdcd865..d6042100a 100644
--- a/numpy/random/randomgen/tests/test_direct.py
+++ b/numpy/random/tests/test_direct.py
@@ -7,10 +7,10 @@ from numpy.testing import assert_equal, assert_allclose, assert_array_equal, \
assert_raises
import pytest
-from ...randomgen import RandomGenerator, MT19937, DSFMT, ThreeFry32, ThreeFry, \
+from numpy.random import RandomGenerator, MT19937, DSFMT, ThreeFry32, ThreeFry, \
PCG32, PCG64, Philox, Xoroshiro128, Xorshift1024, Xoshiro256StarStar, \
Xoshiro512StarStar, RandomState
-from ...randomgen.common import interface
+from numpy.random.common import interface
try:
import cffi # noqa: F401
@@ -206,30 +206,30 @@ class Base(object):
def test_seed_float(self):
# GH #82
rs = RandomGenerator(self.brng(*self.data1['seed']))
- assert_raises(self.seed_error_type, rs.seed, np.pi)
- assert_raises(self.seed_error_type, rs.seed, -np.pi)
+ assert_raises(self.seed_error_type, rs.brng.seed, np.pi)
+ assert_raises(self.seed_error_type, rs.brng.seed, -np.pi)
def test_seed_float_array(self):
# GH #82
rs = RandomGenerator(self.brng(*self.data1['seed']))
- assert_raises(self.seed_error_type, rs.seed, np.array([np.pi]))
- assert_raises(self.seed_error_type, rs.seed, np.array([-np.pi]))
- assert_raises(ValueError, rs.seed, np.array([np.pi, -np.pi]))
- assert_raises(TypeError, rs.seed, np.array([0, np.pi]))
- assert_raises(TypeError, rs.seed, [np.pi])
- assert_raises(TypeError, rs.seed, [0, np.pi])
+ assert_raises(self.seed_error_type, rs.brng.seed, np.array([np.pi]))
+ assert_raises(self.seed_error_type, rs.brng.seed, np.array([-np.pi]))
+ assert_raises(ValueError, rs.brng.seed, np.array([np.pi, -np.pi]))
+ assert_raises(TypeError, rs.brng.seed, np.array([0, np.pi]))
+ assert_raises(TypeError, rs.brng.seed, [np.pi])
+ assert_raises(TypeError, rs.brng.seed, [0, np.pi])
def test_seed_out_of_range(self):
# GH #82
rs = RandomGenerator(self.brng(*self.data1['seed']))
- assert_raises(ValueError, rs.seed, 2 ** (2 * self.bits + 1))
- assert_raises(ValueError, rs.seed, -1)
+ assert_raises(ValueError, rs.brng.seed, 2 ** (2 * self.bits + 1))
+ assert_raises(ValueError, rs.brng.seed, -1)
def test_seed_out_of_range_array(self):
# GH #82
rs = RandomGenerator(self.brng(*self.data1['seed']))
- assert_raises(ValueError, rs.seed, [2 ** (2 * self.bits + 1)])
- assert_raises(ValueError, rs.seed, [-1])
+ assert_raises(ValueError, rs.brng.seed, [2 ** (2 * self.bits + 1)])
+ assert_raises(ValueError, rs.brng.seed, [-1])
def test_repr(self):
rs = RandomGenerator(self.brng(*self.data1['seed']))
@@ -412,18 +412,18 @@ class TestPCG64(Base):
def test_seed_float_array(self):
rs = RandomGenerator(self.brng(*self.data1['seed']))
- assert_raises(self.seed_error_type, rs.seed, np.array([np.pi]))
- assert_raises(self.seed_error_type, rs.seed, np.array([-np.pi]))
- assert_raises(self.seed_error_type, rs.seed, np.array([np.pi, -np.pi]))
- assert_raises(self.seed_error_type, rs.seed, np.array([0, np.pi]))
- assert_raises(self.seed_error_type, rs.seed, [np.pi])
- assert_raises(self.seed_error_type, rs.seed, [0, np.pi])
+ assert_raises(self.seed_error_type, rs.brng.seed, np.array([np.pi]))
+ assert_raises(self.seed_error_type, rs.brng.seed, np.array([-np.pi]))
+ assert_raises(self.seed_error_type, rs.brng.seed, np.array([np.pi, -np.pi]))
+ assert_raises(self.seed_error_type, rs.brng.seed, np.array([0, np.pi]))
+ assert_raises(self.seed_error_type, rs.brng.seed, [np.pi])
+ assert_raises(self.seed_error_type, rs.brng.seed, [0, np.pi])
def test_seed_out_of_range_array(self):
rs = RandomGenerator(self.brng(*self.data1['seed']))
- assert_raises(self.seed_error_type, rs.seed,
+ assert_raises(self.seed_error_type, rs.brng.seed,
[2 ** (2 * self.bits + 1)])
- assert_raises(self.seed_error_type, rs.seed, [-1])
+ assert_raises(self.seed_error_type, rs.brng.seed, [-1])
class TestPhilox(Base):
@@ -464,43 +464,45 @@ class TestMT19937(Base):
def test_seed_out_of_range(self):
# GH #82
rs = RandomGenerator(self.brng(*self.data1['seed']))
- assert_raises(ValueError, rs.seed, 2 ** (self.bits + 1))
- assert_raises(ValueError, rs.seed, -1)
- assert_raises(ValueError, rs.seed, 2 ** (2 * self.bits + 1))
+ assert_raises(ValueError, rs.brng.seed, 2 ** (self.bits + 1))
+ assert_raises(ValueError, rs.brng.seed, -1)
+ assert_raises(ValueError, rs.brng.seed, 2 ** (2 * self.bits + 1))
def test_seed_out_of_range_array(self):
# GH #82
rs = RandomGenerator(self.brng(*self.data1['seed']))
- assert_raises(ValueError, rs.seed, [2 ** (self.bits + 1)])
- assert_raises(ValueError, rs.seed, [-1])
- assert_raises(TypeError, rs.seed, [2 ** (2 * self.bits + 1)])
+ assert_raises(ValueError, rs.brng.seed, [2 ** (self.bits + 1)])
+ assert_raises(ValueError, rs.brng.seed, [-1])
+ assert_raises(TypeError, rs.brng.seed, [2 ** (2 * self.bits + 1)])
def test_seed_float(self):
# GH #82
rs = RandomGenerator(self.brng(*self.data1['seed']))
- assert_raises(TypeError, rs.seed, np.pi)
- assert_raises(TypeError, rs.seed, -np.pi)
+ assert_raises(TypeError, rs.brng.seed, np.pi)
+ assert_raises(TypeError, rs.brng.seed, -np.pi)
def test_seed_float_array(self):
# GH #82
rs = RandomGenerator(self.brng(*self.data1['seed']))
- assert_raises(TypeError, rs.seed, np.array([np.pi]))
- assert_raises(TypeError, rs.seed, np.array([-np.pi]))
- assert_raises(TypeError, rs.seed, np.array([np.pi, -np.pi]))
- assert_raises(TypeError, rs.seed, np.array([0, np.pi]))
- assert_raises(TypeError, rs.seed, [np.pi])
- assert_raises(TypeError, rs.seed, [0, np.pi])
+ brng = rs.brng
+ assert_raises(TypeError, brng.seed, np.array([np.pi]))
+ assert_raises(TypeError, brng.seed, np.array([-np.pi]))
+ assert_raises(TypeError, brng.seed, np.array([np.pi, -np.pi]))
+ assert_raises(TypeError, brng.seed, np.array([0, np.pi]))
+ assert_raises(TypeError, brng.seed, [np.pi])
+ assert_raises(TypeError, brng.seed, [0, np.pi])
def test_state_tuple(self):
rs = RandomGenerator(self.brng(*self.data1['seed']))
- state = rs.state
+ brng = rs.brng
+ state = brng.state
desired = rs.randint(2 ** 16)
tup = (state['brng'], state['state']['key'], state['state']['pos'])
- rs.state = tup
+ brng.state = tup
actual = rs.randint(2 ** 16)
assert_equal(actual, desired)
tup = tup + (0, 0.0)
- rs.state = tup
+ brng.state = tup
actual = rs.randint(2 ** 16)
assert_equal(actual, desired)
@@ -542,25 +544,25 @@ class TestDSFMT(Base):
def test_seed_out_of_range_array(self):
# GH #82
rs = RandomGenerator(self.brng(*self.data1['seed']))
- assert_raises(ValueError, rs.seed, [2 ** (self.bits + 1)])
- assert_raises(ValueError, rs.seed, [-1])
- assert_raises(TypeError, rs.seed, [2 ** (2 * self.bits + 1)])
+ assert_raises(ValueError, rs.brng.seed, [2 ** (self.bits + 1)])
+ assert_raises(ValueError, rs.brng.seed, [-1])
+ assert_raises(TypeError, rs.brng.seed, [2 ** (2 * self.bits + 1)])
def test_seed_float(self):
# GH #82
rs = RandomGenerator(self.brng(*self.data1['seed']))
- assert_raises(TypeError, rs.seed, np.pi)
- assert_raises(TypeError, rs.seed, -np.pi)
+ assert_raises(TypeError, rs.brng.seed, np.pi)
+ assert_raises(TypeError, rs.brng.seed, -np.pi)
def test_seed_float_array(self):
# GH #82
rs = RandomGenerator(self.brng(*self.data1['seed']))
- assert_raises(TypeError, rs.seed, np.array([np.pi]))
- assert_raises(TypeError, rs.seed, np.array([-np.pi]))
- assert_raises(TypeError, rs.seed, np.array([np.pi, -np.pi]))
- assert_raises(TypeError, rs.seed, np.array([0, np.pi]))
- assert_raises(TypeError, rs.seed, [np.pi])
- assert_raises(TypeError, rs.seed, [0, np.pi])
+ assert_raises(TypeError, rs.brng.seed, np.array([np.pi]))
+ assert_raises(TypeError, rs.brng.seed, np.array([-np.pi]))
+ assert_raises(TypeError, rs.brng.seed, np.array([np.pi, -np.pi]))
+ assert_raises(TypeError, rs.brng.seed, np.array([0, np.pi]))
+ assert_raises(TypeError, rs.brng.seed, [np.pi])
+ assert_raises(TypeError, rs.brng.seed, [0, np.pi])
def test_uniform_float(self):
rs = RandomGenerator(self.brng(*self.data1['seed']))
@@ -578,9 +580,9 @@ class TestDSFMT(Base):
def test_buffer_reset(self):
rs = RandomGenerator(self.brng(*self.data1['seed']))
rs.random_sample(1)
- assert rs.state['buffer_loc'] != 382
- rs.seed(*self.data1['seed'])
- assert rs.state['buffer_loc'] == 382
+ assert rs.brng.state['buffer_loc'] != 382
+ rs.brng.seed(*self.data1['seed'])
+ assert rs.brng.state['buffer_loc'] == 382
class TestThreeFry32(Base):
diff --git a/numpy/random/randomgen/tests/test_generator_mt19937.py b/numpy/random/tests/test_generator_mt19937.py
index 10dd8733a..3eda84d84 100644
--- a/numpy/random/randomgen/tests/test_generator_mt19937.py
+++ b/numpy/random/tests/test_generator_mt19937.py
@@ -7,7 +7,7 @@ from numpy.testing import (
assert_warns, assert_no_warnings, assert_array_equal,
assert_array_almost_equal, suppress_warnings)
-from ...randomgen import RandomGenerator, MT19937
+from numpy.random import RandomGenerator, MT19937
random = RandomGenerator(MT19937())
@@ -96,21 +96,22 @@ class TestSetState(object):
def setup(self):
self.seed = 1234567890
self.rg = RandomGenerator(MT19937(self.seed))
- self.state = self.rg.state
+ self.brng = self.rg.brng
+ self.state = self.brng.state
self.legacy_state = (self.state['brng'],
self.state['state']['key'],
self.state['state']['pos'])
def test_basic(self):
old = self.rg.tomaxint(16)
- self.rg.state = self.state
+ self.brng.state = self.state
new = self.rg.tomaxint(16)
assert_(np.all(old == new))
def test_gaussian_reset(self):
# Make sure the cached every-other-Gaussian is reset.
old = self.rg.standard_normal(size=3)
- self.rg.state = self.state
+ self.brng.state = self.state
new = self.rg.standard_normal(size=3)
assert_(np.all(old == new))
@@ -119,9 +120,9 @@ class TestSetState(object):
# cached Gaussian is restored.
self.rg.standard_normal()
- state = self.rg.state
+ state = self.brng.state
old = self.rg.standard_normal(size=3)
- self.rg.state = state
+ self.brng.state = state
new = self.rg.standard_normal(size=3)
assert_(np.all(old == new))
@@ -244,7 +245,7 @@ class TestRandint(object):
def test_in_bounds_fuzz(self):
# Don't use fixed seed
- random.seed()
+ random.brng.seed()
for dt in self.itype[1:]:
for ubnd in [4, 8, 16]:
@@ -263,13 +264,13 @@ class TestRandint(object):
ubnd = 2 if dt is bool else np.iinfo(dt).max + 1
size = 1000
- random.seed(1234)
+ random.brng.seed(1234)
scalar = self.rfunc(lbnd, ubnd, size=size, dtype=dt)
- random.seed(1234)
+ random.brng.seed(1234)
scalar_array = self.rfunc([lbnd], [ubnd], size=size, dtype=dt)
- random.seed(1234)
+ random.brng.seed(1234)
array = self.rfunc([lbnd] * size, [ubnd] *
size, size=size, dtype=dt)
assert_array_equal(scalar, scalar_array)
@@ -291,7 +292,7 @@ class TestRandint(object):
'uint8': '27dd30c4e08a797063dffac2490b0be6'}
for dt in self.itype[1:]:
- random.seed(1234)
+ random.brng.seed(1234)
# view as little endian for hash
if sys.byteorder == 'little':
@@ -303,7 +304,7 @@ class TestRandint(object):
assert_(tgt[np.dtype(dt).name] == res)
# bools do not depend on endianness
- random.seed(1234)
+ random.brng.seed(1234)
val = self.rfunc(0, 2, size=1000, dtype=bool).view(np.int8)
res = hashlib.md5(val).hexdigest()
assert_(tgt[np.dtype(bool).name] == res)
@@ -316,15 +317,15 @@ class TestRandint(object):
np.bool, bool, np.bool_) else np.iinfo(dt).max + 1
# view as little endian for hash
- random.seed(1234)
+ random.brng.seed(1234)
val = self.rfunc(lbnd, ubnd, size=1000, dtype=dt)
- random.seed(1234)
+ random.brng.seed(1234)
val_bc = self.rfunc([lbnd] * 1000, ubnd, dtype=dt)
assert_array_equal(val, val_bc)
- random.seed(1234)
+ random.brng.seed(1234)
val_bc = self.rfunc([lbnd] * 1000, [ubnd] * 1000, dtype=dt)
assert_array_equal(val, val_bc)
@@ -400,7 +401,7 @@ class TestRandomDist(object):
self.seed = 1234567890
def test_rand(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.rand(3, 2)
desired = np.array([[0.61879477158567997, 0.59162362775974664],
[0.88868358904449662, 0.89165480011560816],
@@ -408,25 +409,25 @@ class TestRandomDist(object):
assert_array_almost_equal(actual, desired, decimal=15)
def test_rand_singleton(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.rand()
desired = 0.61879477158567997
assert_array_almost_equal(actual, desired, decimal=15)
def test_randn(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.randn(3, 2)
desired = np.array([[-3.472754000610961, -0.108938564229143],
[-0.245965753396411, -0.704101550261701],
[0.360102487116356, 0.127832101772367]])
assert_array_almost_equal(actual, desired, decimal=15)
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.randn()
assert_array_almost_equal(actual, desired[0, 0], decimal=15)
def test_randint(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.randint(-99, 99, size=(3, 2))
desired = np.array([[31, 3],
[-52, 41],
@@ -436,7 +437,7 @@ class TestRandomDist(object):
def test_randint_masked(self):
# Test masked rejection sampling algorithm to generate array of
# uint32 in an interval.
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.randint(0, 99, size=(3, 2), dtype=np.uint32,
use_masked=True)
desired = np.array([[2, 47],
@@ -446,7 +447,7 @@ class TestRandomDist(object):
def test_randint_lemire_32(self):
# Test lemire algorithm to generate array of uint32 in an interval.
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.randint(0, 99, size=(3, 2), dtype=np.uint32,
use_masked=False)
desired = np.array([[61, 33],
@@ -456,7 +457,7 @@ class TestRandomDist(object):
def test_randint_lemire_64(self):
# Test lemire algorithm to generate array of uint64 in an interval.
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.randint(0, 99 + 0xFFFFFFFFF, size=(3, 2),
dtype=np.uint64, use_masked=False)
desired = np.array([[42523252834, 40656066204],
@@ -465,7 +466,7 @@ class TestRandomDist(object):
assert_array_equal(actual, desired)
def test_random_integers(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
with suppress_warnings() as sup:
w = sup.record(DeprecationWarning)
actual = random.random_integers(-99, 99, size=(3, 2))
@@ -505,19 +506,19 @@ class TestRandomDist(object):
np.iinfo('l').max, np.iinfo('l').max)
def test_random_sample(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.random_sample((3, 2))
desired = np.array([[0.61879477158567997, 0.59162362775974664],
[0.88868358904449662, 0.89165480011560816],
[0.4575674820298663, 0.7781880808593471]])
assert_array_almost_equal(actual, desired, decimal=15)
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.random_sample()
assert_array_almost_equal(actual, desired[0, 0], decimal=15)
def test_random_sample_float(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.random_sample((3, 2))
desired = np.array([[0.6187948, 0.5916236],
[0.8886836, 0.8916548],
@@ -525,7 +526,7 @@ class TestRandomDist(object):
assert_array_almost_equal(actual, desired, decimal=7)
def test_random_sample_float_scalar(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.random_sample(dtype=np.float32)
desired = 0.6187948
assert_array_almost_equal(actual, desired, decimal=7)
@@ -534,31 +535,31 @@ class TestRandomDist(object):
assert_raises(TypeError, random.random_sample, dtype='int32')
def test_choice_uniform_replace(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.choice(4, 4)
desired = np.array([2, 3, 2, 3])
assert_array_equal(actual, desired)
def test_choice_nonuniform_replace(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.choice(4, 4, p=[0.4, 0.4, 0.1, 0.1])
desired = np.array([1, 1, 2, 2])
assert_array_equal(actual, desired)
def test_choice_uniform_noreplace(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.choice(4, 3, replace=False)
desired = np.array([0, 1, 3])
assert_array_equal(actual, desired)
def test_choice_nonuniform_noreplace(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.choice(4, 3, replace=False, p=[0.1, 0.3, 0.5, 0.1])
desired = np.array([2, 3, 1])
assert_array_equal(actual, desired)
def test_choice_noninteger(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.choice(['a', 'b', 'c', 'd'], 4)
desired = np.array(['c', 'd', 'c', 'd'])
assert_array_equal(actual, desired)
@@ -634,7 +635,7 @@ class TestRandomDist(object):
assert_raises(ValueError, random.choice, a, p=p)
def test_bytes(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.bytes(10)
desired = b'\x82Ui\x9e\xff\x97+Wf\xa5'
assert_equal(actual, desired)
@@ -659,7 +660,7 @@ class TestRandomDist(object):
lambda x: np.asarray([(i, i) for i in x],
[("a", object, 1),
("b", np.int32, 1)])]:
- random.seed(self.seed)
+ random.brng.seed(self.seed)
alist = conv([1, 2, 3, 4, 5, 6, 7, 8, 9, 0])
random.shuffle(alist)
actual = alist
@@ -681,19 +682,19 @@ class TestRandomDist(object):
sorted(b.data[~b.mask]), sorted(b_orig.data[~b_orig.mask]))
def test_permutation(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
alist = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
actual = random.permutation(alist)
desired = [0, 1, 9, 6, 2, 4, 5, 8, 7, 3]
assert_array_equal(actual, desired)
- random.seed(self.seed)
+ random.brng.seed(self.seed)
arr_2d = np.atleast_2d([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]).T
actual = random.permutation(arr_2d)
assert_array_equal(actual, np.atleast_2d(desired).T)
def test_beta(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.beta(.1, .9, size=(3, 2))
desired = np.array(
[[1.45341850513746058e-02, 5.31297615662868145e-04],
@@ -702,20 +703,20 @@ class TestRandomDist(object):
assert_array_almost_equal(actual, desired, decimal=15)
def test_binomial(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.binomial(100.123, .456, size=(3, 2))
desired = np.array([[37, 43],
[42, 48],
[46, 45]])
assert_array_equal(actual, desired)
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.binomial(100.123, .456)
desired = 37
assert_array_equal(actual, desired)
def test_chisquare(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.chisquare(50, size=(3, 2))
desired = np.array([[22.2534560369812, 46.9302393710074],
[52.9974164611614, 85.3559029505718],
@@ -723,7 +724,7 @@ class TestRandomDist(object):
assert_array_almost_equal(actual, desired, decimal=13)
def test_dirichlet(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
alpha = np.array([51.72840233779265162, 39.74494232180943953])
actual = random.dirichlet(alpha, size=(3, 2))
desired = np.array([[[0.444382290764855, 0.555617709235145],
@@ -736,7 +737,7 @@ class TestRandomDist(object):
bad_alpha = np.array([5.4e-01, -1.0e-16])
assert_raises(ValueError, random.dirichlet, bad_alpha)
- random.seed(self.seed)
+ random.brng.seed(self.seed)
alpha = np.array([51.72840233779265162, 39.74494232180943953])
actual = random.dirichlet(alpha)
assert_array_almost_equal(actual, desired[0, 0], decimal=15)
@@ -759,7 +760,7 @@ class TestRandomDist(object):
assert_raises(ValueError, random.dirichlet, alpha)
def test_exponential(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.exponential(1.1234, size=(3, 2))
desired = np.array([[5.350682337747634, 1.152307441755771],
[3.867015473358779, 1.538765912839396],
@@ -771,7 +772,7 @@ class TestRandomDist(object):
assert_raises(ValueError, random.exponential, scale=-0.)
def test_f(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.f(12, 77, size=(3, 2))
desired = np.array([[0.809498839488467, 2.867222762455471],
[0.588036831639353, 1.012185639664636],
@@ -779,7 +780,7 @@ class TestRandomDist(object):
assert_array_almost_equal(actual, desired, decimal=15)
def test_gamma(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.gamma(5, 3, size=(3, 2))
desired = np.array([[12.46569350177219, 16.46580642087044],
[43.65744473309084, 11.98722785682592],
@@ -791,7 +792,7 @@ class TestRandomDist(object):
assert_raises(ValueError, random.gamma, shape=-0., scale=-0.)
def test_geometric(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.geometric(.123456789, size=(3, 2))
desired = np.array([[8, 7],
[17, 17],
@@ -809,7 +810,7 @@ class TestRandomDist(object):
assert_raises(ValueError, random.geometric, [np.nan] * 10)
def test_gumbel(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.gumbel(loc=.123456789, scale=2.0, size=(3, 2))
desired = np.array([[0.19591898743416816, 0.34405539668096674],
[-1.4492522252274278, -1.47374816298446865],
@@ -821,7 +822,7 @@ class TestRandomDist(object):
assert_raises(ValueError, random.gumbel, scale=-0.)
def test_hypergeometric(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.hypergeometric(10.1, 5.5, 14, size=(3, 2))
desired = np.array([[10, 10],
[10, 10],
@@ -847,7 +848,7 @@ class TestRandomDist(object):
assert_array_equal(actual, desired)
def test_laplace(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.laplace(loc=.123456789, scale=2.0, size=(3, 2))
desired = np.array([[0.66599721112760157, 0.52829452552221945],
[3.12791959514407125, 3.18202813572992005],
@@ -859,7 +860,7 @@ class TestRandomDist(object):
assert_raises(ValueError, random.laplace, scale=-0.)
def test_logistic(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.logistic(loc=.123456789, scale=2.0, size=(3, 2))
desired = np.array([[1.09232835305011444, 0.8648196662399954],
[4.27818590694950185, 4.33897006346929714],
@@ -867,7 +868,7 @@ class TestRandomDist(object):
assert_array_almost_equal(actual, desired, decimal=15)
def test_lognormal(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.lognormal(mean=.123456789, sigma=2.0, size=(3, 2))
desired = np.array([[1.0894838661036e-03, 9.0990021488311e-01],
[6.9178869932225e-01, 2.7672077560016e-01],
@@ -879,7 +880,7 @@ class TestRandomDist(object):
assert_raises(ValueError, random.lognormal, sigma=-0.)
def test_logseries(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.logseries(p=.923456789, size=(3, 2))
desired = np.array([[2, 2],
[6, 17],
@@ -893,7 +894,7 @@ class TestRandomDist(object):
assert_raises(ValueError, random.logseries, [np.nan] * 10)
def test_multinomial(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.multinomial(20, [1 / 6.] * 6, size=(3, 2))
desired = np.array([[[4, 3, 5, 4, 2, 2],
[5, 2, 8, 2, 2, 1]],
@@ -904,7 +905,7 @@ class TestRandomDist(object):
assert_array_equal(actual, desired)
def test_multivariate_normal(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
mean = (.123456789, 10)
cov = [[1, 0], [0, 1]]
size = (3, 2)
@@ -955,7 +956,7 @@ class TestRandomDist(object):
mu, np.eye(3))
def test_negative_binomial(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.negative_binomial(n=100, p=.12345, size=(3, 2))
desired = np.array([[521, 736],
[665, 690],
@@ -970,7 +971,7 @@ class TestRandomDist(object):
[np.nan] * 10)
def test_noncentral_chisquare(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.noncentral_chisquare(df=5, nonc=5, size=(3, 2))
desired = np.array([[9.47783251920357, 10.02066178260461],
[3.15869984192364, 10.5581565031544],
@@ -983,7 +984,7 @@ class TestRandomDist(object):
[1.41985055641800, 0.15451287602753]])
assert_array_almost_equal(actual, desired, decimal=14)
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.noncentral_chisquare(df=5, nonc=0, size=(3, 2))
desired = np.array([[3.64881368071039, 5.48224544747803],
[20.41999842025404, 3.44075915187367],
@@ -991,7 +992,7 @@ class TestRandomDist(object):
assert_array_almost_equal(actual, desired, decimal=14)
def test_noncentral_f(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.noncentral_f(dfnum=5, dfden=2, nonc=1,
size=(3, 2))
desired = np.array([[1.22680230963236, 2.56457837623956],
@@ -1000,12 +1001,12 @@ class TestRandomDist(object):
assert_array_almost_equal(actual, desired, decimal=14)
def test_noncentral_f_nan(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.noncentral_f(dfnum=5, dfden=2, nonc=np.nan)
assert np.isnan(actual)
def test_normal(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.normal(loc=.123456789, scale=2.0, size=(3, 2))
desired = np.array([[-6.822051212221923, -0.094420339458285],
[-0.368474717792823, -1.284746311523402],
@@ -1017,7 +1018,7 @@ class TestRandomDist(object):
assert_raises(ValueError, random.normal, scale=-0.)
def test_pareto(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.pareto(a=.123456789, size=(3, 2))
desired = np.array([[5.6883528121891552e+16, 4.0569373841667057e+03],
[1.2854967019379475e+12, 6.5833156486851483e+04],
@@ -1031,7 +1032,7 @@ class TestRandomDist(object):
np.testing.assert_array_almost_equal_nulp(actual, desired, nulp=30)
def test_poisson(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.poisson(lam=.123456789, size=(3, 2))
desired = np.array([[0, 0],
[1, 0],
@@ -1051,7 +1052,7 @@ class TestRandomDist(object):
assert_raises(ValueError, random.poisson, [np.nan] * 10)
def test_power(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.power(a=.123456789, size=(3, 2))
desired = np.array([[9.328833342693975e-01, 2.742250409261003e-02],
[7.684513237993961e-01, 9.297548209160028e-02],
@@ -1059,7 +1060,7 @@ class TestRandomDist(object):
assert_array_almost_equal(actual, desired, decimal=15)
def test_rayleigh(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.rayleigh(scale=10, size=(3, 2))
desired = np.array([[13.8882496494248393, 13.383318339044731],
[20.95413364294492098, 21.08285015800712614],
@@ -1071,7 +1072,7 @@ class TestRandomDist(object):
assert_raises(ValueError, random.rayleigh, scale=-0.)
def test_standard_cauchy(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.standard_cauchy(size=(3, 2))
desired = np.array([[31.87809592667601, 0.349332782046838],
[2.816995747731641, 10.552372563459114],
@@ -1079,7 +1080,7 @@ class TestRandomDist(object):
assert_array_almost_equal(actual, desired, decimal=15)
def test_standard_exponential(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.standard_exponential(size=(3, 2), method='inv')
desired = np.array([[0.96441739162374596, 0.89556604882105506],
[2.1953785836319808, 2.22243285392490542],
@@ -1090,7 +1091,7 @@ class TestRandomDist(object):
assert_raises(TypeError, random.standard_exponential, dtype=np.int32)
def test_standard_gamma(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.standard_gamma(shape=3, size=(3, 2))
desired = np.array([[2.28483515569645, 3.29899524967824],
[11.12492298902645, 2.16784417297277],
@@ -1098,13 +1099,13 @@ class TestRandomDist(object):
assert_array_almost_equal(actual, desired, decimal=14)
def test_standard_gammma_scalar_float(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.standard_gamma(3, dtype=np.float32)
desired = 1.3877466
assert_array_almost_equal(actual, desired, decimal=6)
def test_standard_gamma_float(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.standard_gamma(shape=3, size=(3, 2))
desired = np.array([[2.2848352, 3.2989952],
[11.124923, 2.1678442],
@@ -1113,14 +1114,14 @@ class TestRandomDist(object):
def test_standard_gammma_float_out(self):
actual = np.zeros((3, 2), dtype=np.float32)
- random.seed(self.seed)
+ random.brng.seed(self.seed)
random.standard_gamma(10.0, out=actual, dtype=np.float32)
desired = np.array([[6.9824033, 7.3731737],
[14.860578, 7.5327270],
[11.767487, 6.2320185]], dtype=np.float32)
assert_array_almost_equal(actual, desired, decimal=5)
- random.seed(self.seed)
+ random.brng.seed(self.seed)
random.standard_gamma(10.0, out=actual, size=(3, 2), dtype=np.float32)
assert_array_almost_equal(actual, desired, decimal=5)
@@ -1140,7 +1141,7 @@ class TestRandomDist(object):
assert_raises(ValueError, random.standard_gamma, shape=-0.)
def test_standard_normal(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.standard_normal(size=(3, 2))
desired = np.array([[-3.472754000610961, -0.108938564229143],
[-0.245965753396411, -0.704101550261701],
@@ -1151,7 +1152,7 @@ class TestRandomDist(object):
assert_raises(TypeError, random.standard_normal, dtype=np.int32)
def test_standard_t(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.standard_t(df=10, size=(3, 2))
desired = np.array([[-3.68722108185508, -0.672031186266171],
[2.900224996448669, -0.199656996187739],
@@ -1159,7 +1160,7 @@ class TestRandomDist(object):
assert_array_almost_equal(actual, desired, decimal=15)
def test_triangular(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.triangular(left=5.12, mode=10.23, right=20.34,
size=(3, 2))
desired = np.array([[12.68117178949215784, 12.4129206149193152],
@@ -1168,7 +1169,7 @@ class TestRandomDist(object):
assert_array_almost_equal(actual, desired, decimal=14)
def test_uniform(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.uniform(low=1.23, high=10.54, size=(3, 2))
desired = np.array([[6.99097932346268003, 6.73801597444323974],
[9.50364421400426274, 9.53130618907631089],
@@ -1214,7 +1215,7 @@ class TestRandomDist(object):
assert_raises(TypeError, random.hypergeometric, throwing_int, 1, 1)
def test_vonmises(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.vonmises(mu=1.23, kappa=1.54, size=(3, 2))
desired = np.array([[2.28567572673902042, 2.89163838442285037],
[0.38198375564286025, 2.57638023113890746],
@@ -1223,17 +1224,17 @@ class TestRandomDist(object):
def test_vonmises_small(self):
# check infinite loop, gh-4720
- random.seed(self.seed)
+ random.brng.seed(self.seed)
r = random.vonmises(mu=0., kappa=1.1e-8, size=10**6)
assert_(np.isfinite(r).all())
def test_vonmises_nan(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
r = random.vonmises(mu=0., kappa=np.nan)
assert_(np.isnan(r))
def test_wald(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.wald(mean=1.23, scale=1.54, size=(3, 2))
desired = np.array([[0.10653278160339, 0.98771068102461],
[0.89276055317879, 0.13640126419923],
@@ -1241,7 +1242,7 @@ class TestRandomDist(object):
assert_array_almost_equal(actual, desired, decimal=14)
def test_weibull(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.weibull(a=1.23, size=(3, 2))
desired = np.array([[3.557276979846361, 1.020870580998542],
[2.731847777612348, 1.29148068905082],
@@ -1249,12 +1250,12 @@ class TestRandomDist(object):
assert_array_almost_equal(actual, desired, decimal=15)
def test_weibull_0(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
assert_equal(random.weibull(a=0, size=12), np.zeros(12))
assert_raises(ValueError, random.weibull, a=-0.)
def test_zipf(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
actual = random.zipf(a=1.23, size=(3, 2))
desired = np.array([[66, 29],
[1, 1],
@@ -1269,7 +1270,7 @@ class TestBroadcast(object):
self.seed = 123456789
def set_seed(self):
- random.seed(self.seed)
+ random.brng.seed(self.seed)
def test_uniform(self):
low = [0]
diff --git a/numpy/random/randomgen/tests/test_generator_mt19937_regressions.py b/numpy/random/tests/test_generator_mt19937_regressions.py
index 75064720f..f9478ccf6 100644
--- a/numpy/random/randomgen/tests/test_generator_mt19937_regressions.py
+++ b/numpy/random/tests/test_generator_mt19937_regressions.py
@@ -3,7 +3,7 @@ from numpy.testing import (assert_, assert_array_equal)
from numpy.compat import long
import numpy as np
import pytest
-from ...randomgen import RandomGenerator, MT19937
+from numpy.random import RandomGenerator, MT19937
mt19937 = RandomGenerator(MT19937())
@@ -36,7 +36,7 @@ class TestRegression(object):
def test_logseries_convergence(self):
# Test for ticket #923
N = 1000
- mt19937.seed(0)
+ mt19937.brng.seed(0)
rvsn = mt19937.logseries(0.8, size=N)
# these two frequency counts should be close to theoretical
# numbers with this large sample
@@ -50,9 +50,9 @@ class TestRegression(object):
assert_(freq < 0.23, msg)
def test_permutation_longs(self):
- mt19937.seed(1234)
+ mt19937.brng.seed(1234)
a = mt19937.permutation(12)
- mt19937.seed(1234)
+ mt19937.brng.seed(1234)
b = mt19937.permutation(long(12))
assert_array_equal(a, b)
@@ -62,7 +62,7 @@ class TestRegression(object):
[(1, 1), (2, 2), (3, 3), None],
[1, (2, 2), (3, 3), None],
[(1, 1), 2, 3, None]]:
- mt19937.seed(12345)
+ mt19937.brng.seed(12345)
shuffled = list(t)
mt19937.shuffle(shuffled)
assert_array_equal(shuffled, [t[0], t[3], t[1], t[2]])
@@ -72,8 +72,8 @@ class TestRegression(object):
m = RandomGenerator(MT19937()) # mt19937.RandomState()
res = np.array([0, 8, 7, 2, 1, 9, 4, 7, 0, 3])
for i in range(3):
- mt19937.seed(i)
- m.seed(4321)
+ mt19937.brng.seed(i)
+ m.brng.seed(4321)
# If m.state is not honored, the result will change
assert_array_equal(m.choice(10, size=10, p=np.ones(10)/10.), res)
@@ -88,7 +88,7 @@ class TestRegression(object):
def test_beta_small_parameters(self):
# Test that beta with small a and b parameters does not produce
# NaNs due to roundoff errors causing 0 / 0, gh-5851
- mt19937.seed(1234567890)
+ mt19937.brng.seed(1234567890)
x = mt19937.beta(0.0001, 0.0001, size=100)
assert_(not np.any(np.isnan(x)), 'Nans in mt19937.beta')
@@ -96,7 +96,7 @@ class TestRegression(object):
# The sum of probs should be 1.0 with some tolerance.
# For low precision dtypes the tolerance was too tight.
# See numpy github issue 6123.
- mt19937.seed(1234)
+ mt19937.brng.seed(1234)
a = [1, 2, 3]
counts = [4, 4, 2]
for dt in np.float16, np.float32, np.float64:
@@ -110,7 +110,7 @@ class TestRegression(object):
# Test that permuting an array of different length strings
# will not cause a segfault on garbage collection
# Tests gh-7710
- mt19937.seed(1234)
+ mt19937.brng.seed(1234)
a = np.array(['a', 'a' * 1000])
@@ -125,7 +125,7 @@ class TestRegression(object):
# Test that permuting an array of objects will not cause
# a segfault on garbage collection.
# See gh-7719
- mt19937.seed(1234)
+ mt19937.brng.seed(1234)
a = np.array([np.arange(1), np.arange(4)])
for _ in range(1000):
@@ -139,7 +139,7 @@ class TestRegression(object):
class N(np.ndarray):
pass
- mt19937.seed(1)
+ mt19937.brng.seed(1)
orig = np.arange(3).view(N)
perm = mt19937.permutation(orig)
assert_array_equal(perm, np.array([0, 2, 1]))
@@ -151,7 +151,7 @@ class TestRegression(object):
def __array__(self):
return self.a
- mt19937.seed(1)
+ mt19937.brng.seed(1)
m = M()
perm = mt19937.permutation(m)
assert_array_equal(perm, np.array([2, 1, 4, 0, 3]))
diff --git a/numpy/random/randomgen/tests/test_randomstate.py b/numpy/random/tests/test_randomstate.py
index 6adde6c2a..d0ad5e794 100644
--- a/numpy/random/randomgen/tests/test_randomstate.py
+++ b/numpy/random/tests/test_randomstate.py
@@ -9,7 +9,7 @@ from numpy.testing import (
suppress_warnings
)
-from ...randomgen import MT19937, Xoshiro256StarStar, mtrand as random
+from numpy.random import MT19937, Xoshiro256StarStar, mtrand as random
def assert_mt19937_state_equal(a, b):
diff --git a/numpy/random/randomgen/tests/test_randomstate_regression.py b/numpy/random/tests/test_randomstate_regression.py
index cf21ee756..9c319319e 100644
--- a/numpy/random/randomgen/tests/test_randomstate_regression.py
+++ b/numpy/random/tests/test_randomstate_regression.py
@@ -5,7 +5,7 @@ from numpy.testing import (
from numpy.compat import long
import numpy as np
-from ...randomgen import mtrand as random
+from numpy.random import mtrand as random
class TestRegression(object):
diff --git a/numpy/random/randomgen/tests/test_smoke.py b/numpy/random/tests/test_smoke.py
index 816ce6ddc..fa7a0b567 100644
--- a/numpy/random/randomgen/tests/test_smoke.py
+++ b/numpy/random/tests/test_smoke.py
@@ -8,7 +8,7 @@ import numpy as np
import pytest
from numpy.testing import (assert_almost_equal, assert_equal, assert_,
assert_array_equal, suppress_warnings)
-from ...randomgen import (RandomGenerator, MT19937, DSFMT, ThreeFry32, ThreeFry,
+from numpy.random import (RandomGenerator, MT19937, DSFMT, ThreeFry32, ThreeFry,
PCG32, PCG64, Philox, Xoroshiro128, Xorshift1024, Xoshiro256StarStar,
Xoshiro512StarStar, entropy)
@@ -106,7 +106,7 @@ class RNG(object):
cls.advance = None
cls.seed = [12345]
cls.rg = RandomGenerator(cls.brng(*cls.seed))
- cls.initial_state = cls.rg.state
+ cls.initial_state = cls.rg.brng.state
cls.seed_vector_bits = 64
cls._extra_setup()
@@ -118,39 +118,39 @@ class RNG(object):
cls.seed_error = TypeError
def _reset_state(self):
- self.rg.state = self.initial_state
+ self.rg.brng.state = self.initial_state
def test_init(self):
rg = RandomGenerator(self.brng())
- state = rg.state
+ state = rg.brng.state
rg.standard_normal(1)
rg.standard_normal(1)
- rg.state = state
- new_state = rg.state
+ rg.brng.state = state
+ new_state = rg.brng.state
assert_(comp_state(state, new_state))
def test_advance(self):
- state = self.rg.state
- if hasattr(self.rg._basicrng, 'advance'):
- self.rg._basicrng.advance(self.advance)
- assert_(not comp_state(state, self.rg.state))
+ state = self.rg.brng.state
+ if hasattr(self.rg.brng, 'advance'):
+ self.rg.brng.advance(self.advance)
+ assert_(not comp_state(state, self.rg.brng.state))
else:
- brng_name = self.rg._basicrng.__class__.__name__
+ brng_name = self.rg.brng.__class__.__name__
pytest.skip('Advance is not supported by {0}'.format(brng_name))
def test_jump(self):
- state = self.rg.state
- if hasattr(self.rg._basicrng, 'jump'):
- self.rg._basicrng.jump()
- jumped_state = self.rg.state
+ state = self.rg.brng.state
+ if hasattr(self.rg.brng, 'jump'):
+ self.rg.brng.jump()
+ jumped_state = self.rg.brng.state
assert_(not comp_state(state, jumped_state))
self.rg.random_sample(2 * 3 * 5 * 7 * 11 * 13 * 17)
- self.rg.state = state
- self.rg._basicrng.jump()
- rejumped_state = self.rg.state
+ self.rg.brng.state = state
+ self.rg.brng.jump()
+ rejumped_state = self.rg.brng.state
assert_(comp_state(jumped_state, rejumped_state))
else:
- brng_name = self.rg._basicrng.__class__.__name__
+ brng_name = self.rg.brng.__class__.__name__
pytest.skip('Jump is not supported by {0}'.format(brng_name))
def test_uniform(self):
@@ -221,51 +221,51 @@ class RNG(object):
assert_(self.rg.binomial(1000, .5) >= 0)
def test_reset_state(self):
- state = self.rg.state
+ state = self.rg.brng.state
int_1 = self.rg.randint(2**31)
- self.rg.state = state
+ self.rg.brng.state = state
int_2 = self.rg.randint(2**31)
assert_(int_1 == int_2)
def test_entropy_init(self):
rg = RandomGenerator(self.brng())
rg2 = RandomGenerator(self.brng())
- assert_(not comp_state(rg.state, rg2.state))
+ assert_(not comp_state(rg.brng.state, rg2.brng.state))
def test_seed(self):
rg = RandomGenerator(self.brng(*self.seed))
rg2 = RandomGenerator(self.brng(*self.seed))
rg.random_sample()
rg2.random_sample()
- assert_(comp_state(rg.state, rg2.state))
+ assert_(comp_state(rg.brng.state, rg2.brng.state))
def test_reset_state_gauss(self):
rg = RandomGenerator(self.brng(*self.seed))
rg.standard_normal()
- state = rg.state
+ state = rg.brng.state
n1 = rg.standard_normal(size=10)
rg2 = RandomGenerator(self.brng())
- rg2.state = state
+ rg2.brng.state = state
n2 = rg2.standard_normal(size=10)
assert_array_equal(n1, n2)
def test_reset_state_uint32(self):
rg = RandomGenerator(self.brng(*self.seed))
rg.randint(0, 2 ** 24, 120, dtype=np.uint32)
- state = rg.state
+ state = rg.brng.state
n1 = rg.randint(0, 2 ** 24, 10, dtype=np.uint32)
rg2 = RandomGenerator(self.brng())
- rg2.state = state
+ rg2.brng.state = state
n2 = rg2.randint(0, 2 ** 24, 10, dtype=np.uint32)
assert_array_equal(n1, n2)
def test_reset_state_float(self):
rg = RandomGenerator(self.brng(*self.seed))
rg.random_sample(dtype='float32')
- state = rg.state
+ state = rg.brng.state
n1 = rg.random_sample(size=10, dtype='float32')
rg2 = RandomGenerator(self.brng())
- rg2.state = state
+ rg2.brng.state = state
n2 = rg2.random_sample(size=10, dtype='float32')
assert_((n1 == n2).all())
@@ -354,29 +354,29 @@ class RNG(object):
assert_(len(vals) == 10)
def test_rand(self):
- state = self.rg.state
+ state = self.rg.brng.state
vals = self.rg.rand(10, 10, 10)
- self.rg.state = state
+ self.rg.brng.state = state
assert_((vals == self.rg.random_sample((10, 10, 10))).all())
assert_(vals.shape == (10, 10, 10))
vals = self.rg.rand(10, 10, 10, dtype=np.float32)
assert_(vals.shape == (10, 10, 10))
def test_randn(self):
- state = self.rg.state
+ state = self.rg.brng.state
vals = self.rg.randn(10, 10, 10)
- self.rg.state = state
+ self.rg.brng.state = state
assert_equal(vals, self.rg.standard_normal((10, 10, 10)))
assert_equal(vals.shape, (10, 10, 10))
- state = self.rg.state
+ state = self.rg.brng.state
vals = self.rg.randn(10, 10, 10)
- self.rg.state = state
+ self.rg.brng.state = state
assert_equal(vals, self.rg.standard_normal((10, 10, 10)))
- state = self.rg.state
+ state = self.rg.brng.state
self.rg.randn(10, 10, 10)
- self.rg.state = state
+ self.rg.brng.state = state
vals = self.rg.randn(10, 10, 10, dtype=np.float32)
assert_(vals.shape == (10, 10, 10))
@@ -487,12 +487,12 @@ class RNG(object):
pick = pickle.dumps(self.rg)
unpick = pickle.loads(pick)
assert_((type(self.rg) == type(unpick)))
- assert_(comp_state(self.rg.state, unpick.state))
+ assert_(comp_state(self.rg.brng.state, unpick.brng.state))
pick = pickle.dumps(self.rg)
unpick = pickle.loads(pick)
assert_((type(self.rg) == type(unpick)))
- assert_(comp_state(self.rg.state, unpick.state))
+ assert_(comp_state(self.rg.brng.state, unpick.brng.state))
def test_seed_array(self):
if self.seed_vector_bits is None:
@@ -505,32 +505,32 @@ class RNG(object):
else:
dtype = np.uint64
seed = np.array([1], dtype=dtype)
- self.rg.seed(seed)
- state1 = self.rg.state
- self.rg.seed(1)
- state2 = self.rg.state
+ self.rg.brng.seed(seed)
+ state1 = self.rg.brng.state
+ self.rg.brng.seed(1)
+ state2 = self.rg.brng.state
assert_(comp_state(state1, state2))
seed = np.arange(4, dtype=dtype)
- self.rg.seed(seed)
- state1 = self.rg.state
- self.rg.seed(seed[0])
- state2 = self.rg.state
+ self.rg.brng.seed(seed)
+ state1 = self.rg.brng.state
+ self.rg.brng.seed(seed[0])
+ state2 = self.rg.brng.state
assert_(not comp_state(state1, state2))
seed = np.arange(1500, dtype=dtype)
- self.rg.seed(seed)
- state1 = self.rg.state
- self.rg.seed(seed[0])
- state2 = self.rg.state
+ self.rg.brng.seed(seed)
+ state1 = self.rg.brng.state
+ self.rg.brng.seed(seed[0])
+ state2 = self.rg.brng.state
assert_(not comp_state(state1, state2))
seed = 2 ** np.mod(np.arange(1500, dtype=dtype),
self.seed_vector_bits - 1) + 1
- self.rg.seed(seed)
- state1 = self.rg.state
- self.rg.seed(seed[0])
- state2 = self.rg.state
+ self.rg.brng.seed(seed)
+ state1 = self.rg.brng.state
+ self.rg.brng.seed(seed[0])
+ state2 = self.rg.brng.state
assert_(not comp_state(state1, state2))
def test_seed_array_error(self):
@@ -541,164 +541,164 @@ class RNG(object):
seed = -1
with pytest.raises(ValueError):
- self.rg.seed(seed)
+ self.rg.brng.seed(seed)
seed = np.array([-1], dtype=np.int32)
with pytest.raises(ValueError):
- self.rg.seed(seed)
+ self.rg.brng.seed(seed)
seed = np.array([1, 2, 3, -5], dtype=np.int32)
with pytest.raises(ValueError):
- self.rg.seed(seed)
+ self.rg.brng.seed(seed)
seed = np.array([1, 2, 3, out_of_bounds])
with pytest.raises(ValueError):
- self.rg.seed(seed)
+ self.rg.brng.seed(seed)
def test_uniform_float(self):
rg = RandomGenerator(self.brng(12345))
warmup(rg)
- state = rg.state
+ state = rg.brng.state
r1 = rg.random_sample(11, dtype=np.float32)
rg2 = RandomGenerator(self.brng())
warmup(rg2)
- rg2.state = state
+ rg2.brng.state = state
r2 = rg2.random_sample(11, dtype=np.float32)
assert_array_equal(r1, r2)
assert_equal(r1.dtype, np.float32)
- assert_(comp_state(rg.state, rg2.state))
+ assert_(comp_state(rg.brng.state, rg2.brng.state))
def test_gamma_floats(self):
rg = RandomGenerator(self.brng())
warmup(rg)
- state = rg.state
+ state = rg.brng.state
r1 = rg.standard_gamma(4.0, 11, dtype=np.float32)
rg2 = RandomGenerator(self.brng())
warmup(rg2)
- rg2.state = state
+ rg2.brng.state = state
r2 = rg2.standard_gamma(4.0, 11, dtype=np.float32)
assert_array_equal(r1, r2)
assert_equal(r1.dtype, np.float32)
- assert_(comp_state(rg.state, rg2.state))
+ assert_(comp_state(rg.brng.state, rg2.brng.state))
def test_normal_floats(self):
rg = RandomGenerator(self.brng())
warmup(rg)
- state = rg.state
+ state = rg.brng.state
r1 = rg.standard_normal(11, dtype=np.float32)
rg2 = RandomGenerator(self.brng())
warmup(rg2)
- rg2.state = state
+ rg2.brng.state = state
r2 = rg2.standard_normal(11, dtype=np.float32)
assert_array_equal(r1, r2)
assert_equal(r1.dtype, np.float32)
- assert_(comp_state(rg.state, rg2.state))
+ assert_(comp_state(rg.brng.state, rg2.brng.state))
def test_normal_zig_floats(self):
rg = RandomGenerator(self.brng())
warmup(rg)
- state = rg.state
+ state = rg.brng.state
r1 = rg.standard_normal(11, dtype=np.float32)
rg2 = RandomGenerator(self.brng())
warmup(rg2)
- rg2.state = state
+ rg2.brng.state = state
r2 = rg2.standard_normal(11, dtype=np.float32)
assert_array_equal(r1, r2)
assert_equal(r1.dtype, np.float32)
- assert_(comp_state(rg.state, rg2.state))
+ assert_(comp_state(rg.brng.state, rg2.brng.state))
def test_output_fill(self):
rg = self.rg
- state = rg.state
+ state = rg.brng.state
size = (31, 7, 97)
existing = np.empty(size)
- rg.state = state
+ rg.brng.state = state
rg.standard_normal(out=existing)
- rg.state = state
+ rg.brng.state = state
direct = rg.standard_normal(size=size)
assert_equal(direct, existing)
sized = np.empty(size)
- rg.state = state
+ rg.brng.state = state
rg.standard_normal(out=sized, size=sized.shape)
existing = np.empty(size, dtype=np.float32)
- rg.state = state
+ rg.brng.state = state
rg.standard_normal(out=existing, dtype=np.float32)
- rg.state = state
+ rg.brng.state = state
direct = rg.standard_normal(size=size, dtype=np.float32)
assert_equal(direct, existing)
def test_output_filling_uniform(self):
rg = self.rg
- state = rg.state
+ state = rg.brng.state
size = (31, 7, 97)
existing = np.empty(size)
- rg.state = state
+ rg.brng.state = state
rg.random_sample(out=existing)
- rg.state = state
+ rg.brng.state = state
direct = rg.random_sample(size=size)
assert_equal(direct, existing)
existing = np.empty(size, dtype=np.float32)
- rg.state = state
+ rg.brng.state = state
rg.random_sample(out=existing, dtype=np.float32)
- rg.state = state
+ rg.brng.state = state
direct = rg.random_sample(size=size, dtype=np.float32)
assert_equal(direct, existing)
def test_output_filling_exponential(self):
rg = self.rg
- state = rg.state
+ state = rg.brng.state
size = (31, 7, 97)
existing = np.empty(size)
- rg.state = state
+ rg.brng.state = state
rg.standard_exponential(out=existing)
- rg.state = state
+ rg.brng.state = state
direct = rg.standard_exponential(size=size)
assert_equal(direct, existing)
existing = np.empty(size, dtype=np.float32)
- rg.state = state
+ rg.brng.state = state
rg.standard_exponential(out=existing, dtype=np.float32)
- rg.state = state
+ rg.brng.state = state
direct = rg.standard_exponential(size=size, dtype=np.float32)
assert_equal(direct, existing)
def test_output_filling_gamma(self):
rg = self.rg
- state = rg.state
+ state = rg.brng.state
size = (31, 7, 97)
existing = np.zeros(size)
- rg.state = state
+ rg.brng.state = state
rg.standard_gamma(1.0, out=existing)
- rg.state = state
+ rg.brng.state = state
direct = rg.standard_gamma(1.0, size=size)
assert_equal(direct, existing)
existing = np.zeros(size, dtype=np.float32)
- rg.state = state
+ rg.brng.state = state
rg.standard_gamma(1.0, out=existing, dtype=np.float32)
- rg.state = state
+ rg.brng.state = state
direct = rg.standard_gamma(1.0, size=size, dtype=np.float32)
assert_equal(direct, existing)
def test_output_filling_gamma_broadcast(self):
rg = self.rg
- state = rg.state
+ state = rg.brng.state
size = (31, 7, 97)
mu = np.arange(97.0) + 1.0
existing = np.zeros(size)
- rg.state = state
+ rg.brng.state = state
rg.standard_gamma(mu, out=existing)
- rg.state = state
+ rg.brng.state = state
direct = rg.standard_gamma(mu, size=size)
assert_equal(direct, existing)
existing = np.zeros(size, dtype=np.float32)
- rg.state = state
+ rg.brng.state = state
rg.standard_gamma(mu, out=existing, dtype=np.float32)
- rg.state = state
+ rg.brng.state = state
direct = rg.standard_gamma(mu, size=size, dtype=np.float32)
assert_equal(direct, existing)
@@ -796,7 +796,7 @@ class TestMT19937(RNG):
cls.advance = None
cls.seed = [2 ** 21 + 2 ** 16 + 2 ** 5 + 1]
cls.rg = RandomGenerator(cls.brng(*cls.seed))
- cls.initial_state = cls.rg.state
+ cls.initial_state = cls.rg.brng.state
cls.seed_vector_bits = 32
cls._extra_setup()
cls.seed_error = ValueError
@@ -805,8 +805,8 @@ class TestMT19937(RNG):
nprg = np.random.RandomState()
nprg.standard_normal(99)
state = nprg.get_state()
- self.rg.state = state
- state2 = self.rg.state
+ self.rg.brng.state = state
+ state2 = self.rg.brng.state
assert_((state[1] == state2['state']['key']).all())
assert_((state[2] == state2['state']['pos']))
@@ -819,7 +819,7 @@ class TestPCG64(RNG):
cls.seed = [2 ** 96 + 2 ** 48 + 2 ** 21 + 2 ** 16 + 2 ** 5 + 1,
2 ** 21 + 2 ** 16 + 2 ** 5 + 1]
cls.rg = RandomGenerator(cls.brng(*cls.seed))
- cls.initial_state = cls.rg.state
+ cls.initial_state = cls.rg.brng.state
cls.seed_vector_bits = None
cls._extra_setup()
@@ -832,20 +832,20 @@ class TestPCG64(RNG):
seed = -1
with pytest.raises(ValueError):
- self.rg.seed(seed)
+ self.rg.brng.seed(seed)
error_type = ValueError if self.seed_vector_bits else TypeError
seed = np.array([-1], dtype=np.int32)
with pytest.raises(error_type):
- self.rg.seed(seed)
+ self.rg.brng.seed(seed)
seed = np.array([1, 2, 3, -5], dtype=np.int32)
with pytest.raises(error_type):
- self.rg.seed(seed)
+ self.rg.brng.seed(seed)
seed = np.array([1, 2, 3, out_of_bounds])
with pytest.raises(error_type):
- self.rg.seed(seed)
+ self.rg.brng.seed(seed)
class TestPhilox(RNG):
@@ -855,7 +855,7 @@ class TestPhilox(RNG):
cls.advance = 2**63 + 2**31 + 2**15 + 1
cls.seed = [12345]
cls.rg = RandomGenerator(cls.brng(*cls.seed))
- cls.initial_state = cls.rg.state
+ cls.initial_state = cls.rg.brng.state
cls.seed_vector_bits = 64
cls._extra_setup()
@@ -867,7 +867,7 @@ class TestThreeFry(RNG):
cls.advance = 2 ** 63 + 2 ** 31 + 2 ** 15 + 1
cls.seed = [12345]
cls.rg = RandomGenerator(cls.brng(*cls.seed))
- cls.initial_state = cls.rg.state
+ cls.initial_state = cls.rg.brng.state
cls.seed_vector_bits = 64
cls._extra_setup()
@@ -879,7 +879,7 @@ class TestXoroshiro128(RNG):
cls.advance = None
cls.seed = [12345]
cls.rg = RandomGenerator(cls.brng(*cls.seed))
- cls.initial_state = cls.rg.state
+ cls.initial_state = cls.rg.brng.state
cls.seed_vector_bits = 64
cls._extra_setup()
@@ -891,7 +891,7 @@ class TestXoshiro256StarStar(RNG):
cls.advance = None
cls.seed = [12345]
cls.rg = RandomGenerator(cls.brng(*cls.seed))
- cls.initial_state = cls.rg.state
+ cls.initial_state = cls.rg.brng.state
cls.seed_vector_bits = 64
cls._extra_setup()
@@ -903,7 +903,7 @@ class TestXoshiro512StarStar(RNG):
cls.advance = None
cls.seed = [12345]
cls.rg = RandomGenerator(cls.brng(*cls.seed))
- cls.initial_state = cls.rg.state
+ cls.initial_state = cls.rg.brng.state
cls.seed_vector_bits = 64
cls._extra_setup()
@@ -915,7 +915,7 @@ class TestXorshift1024(RNG):
cls.advance = None
cls.seed = [12345]
cls.rg = RandomGenerator(cls.brng(*cls.seed))
- cls.initial_state = cls.rg.state
+ cls.initial_state = cls.rg.brng.state
cls.seed_vector_bits = 64
cls._extra_setup()
@@ -927,7 +927,7 @@ class TestDSFMT(RNG):
cls.advance = None
cls.seed = [12345]
cls.rg = RandomGenerator(cls.brng(*cls.seed))
- cls.initial_state = cls.rg.state
+ cls.initial_state = cls.rg.brng.state
cls._extra_setup()
cls.seed_vector_bits = 32
@@ -939,7 +939,7 @@ class TestThreeFry32(RNG):
cls.advance = 2**63 + 2**31 + 2**15 + 1
cls.seed = [2 ** 21 + 2 ** 16 + 2 ** 5 + 1]
cls.rg = RandomGenerator(cls.brng(*cls.seed))
- cls.initial_state = cls.rg.state
+ cls.initial_state = cls.rg.brng.state
cls.seed_vector_bits = 64
cls._extra_setup()
cls.seed_error = ValueError
@@ -972,6 +972,6 @@ class TestPCG32(TestPCG64):
cls.seed = [2 ** 48 + 2 ** 21 + 2 ** 16 + 2 ** 5 + 1,
2 ** 21 + 2 ** 16 + 2 ** 5 + 1]
cls.rg = RandomGenerator(cls.brng(*cls.seed))
- cls.initial_state = cls.rg.state
+ cls.initial_state = cls.rg.brng.state
cls.seed_vector_bits = None
cls._extra_setup()
diff --git a/numpy/random/randomgen/threefry.pyx b/numpy/random/threefry.pyx
index 8140c6a9b..8140c6a9b 100644
--- a/numpy/random/randomgen/threefry.pyx
+++ b/numpy/random/threefry.pyx
diff --git a/numpy/random/randomgen/threefry32.pyx b/numpy/random/threefry32.pyx
index 1fa98eabd..1fa98eabd 100644
--- a/numpy/random/randomgen/threefry32.pyx
+++ b/numpy/random/threefry32.pyx
diff --git a/numpy/random/randomgen/xoroshiro128.pyx b/numpy/random/xoroshiro128.pyx
index 7795500e8..7795500e8 100644
--- a/numpy/random/randomgen/xoroshiro128.pyx
+++ b/numpy/random/xoroshiro128.pyx
diff --git a/numpy/random/randomgen/xorshift1024.pyx b/numpy/random/xorshift1024.pyx
index 3c7ffac52..3c7ffac52 100644
--- a/numpy/random/randomgen/xorshift1024.pyx
+++ b/numpy/random/xorshift1024.pyx
diff --git a/numpy/random/randomgen/xoshiro256starstar.pyx b/numpy/random/xoshiro256starstar.pyx
index c3856b6f7..c3856b6f7 100644
--- a/numpy/random/randomgen/xoshiro256starstar.pyx
+++ b/numpy/random/xoshiro256starstar.pyx
diff --git a/numpy/random/randomgen/xoshiro512starstar.pyx b/numpy/random/xoshiro512starstar.pyx
index 761d1f1d0..761d1f1d0 100644
--- a/numpy/random/randomgen/xoshiro512starstar.pyx
+++ b/numpy/random/xoshiro512starstar.pyx