summaryrefslogtreecommitdiff
path: root/numpy/random/tests
Commit message (Collapse)AuthorAgeFilesLines
...
* ENH: np.random.default_gen() (#13840)Robert Kern2019-06-282-1/+61
| | | * ENH: Rename seed_seq argument to seed and replace Generator() with default_gen()
* ENH: Add SFC64 BitGenerator.Robert Kern2019-06-254-3/+2032
|
* BUG: Fix missing SeedSequence import.Charles Harris2019-06-251-1/+3
|
* MAINT: Fix bad merge.Charles Harris2019-06-251-6/+0
|
* MAINT: remove leftover files, fix docsmattip2019-06-262-2002/+0
|
* ENH: use SeedSequence to generate entropy for seedingmattip2019-06-2612-6679/+6547
|
* MAINT: remove xoshiro* BitGeneratorsmattip2019-06-267-4069/+7
|
* MAINT: remove ThreeFry BitGeneratormattip2019-06-254-2039/+2
|
* MAINT: remove pcg32 BitGeneratormattip2019-06-252-29/+2
|
* MAINT: remove dSFMTmattip2019-06-164-2097/+2
|
* MAINT: random: Rewrite the hypergeometric distribution.Warren Weckesser2019-06-142-13/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary of the changes: * Move the functions random_hypergeometric_hyp, random_hypergeometric_hrua and random_hypergeometric from distributions.c to legacy-distributions.c. These are now the legacy implementation of hypergeometric. * Add the files logfactorial.c and logfactorial.h, containing the function logfactorial(int64_t k). * Add the files random_hypergeometric.c and random_hypergeometric.h, containing the function random_hypergeometric (the new implementation of the hypergeometric distribution). See more details below. * Fix two tests in numpy/random/tests/test_generator_mt19937.py that used values returned by the hypergeometric distribution. The new implementation changes the stream, so those tests needed to be updated. * Remove another test obviated by an added constraint on the arguments of hypergeometric. Details of the rewrite: If you carefully step through the old function rk_hypergeometric_hyp(), you'll see that the end result is basically the same as the new function hypergeometric_sample(), but the new function accomplishes the result with just integers. The floating point calculations in the old code caused problems when the arguments were extremely large (explained in more detail in the unmerged pull request https://github.com/numpy/numpy/pull/9834). The new version of hypergeometric_hrua() is a new translation of Stadlober's ratio-of-uniforms algorithm for the hypergeometric distribution. It fixes a mistake in the old implementation that made the method less efficient than it could be (see the details in the unmerged pull request https://github.com/numpy/numpy/pull/11138), and uses a faster function for computing log(k!). The HRUA algorithm suffers from loss of floating point precision when the arguments are *extremely* large (see the comments in github issue 11443). To avoid these problems, the arguments `ngood` and `nbad` of hypergeometric must be less than 10**9. This constraint obviates an existing regression test that was run on systems with 64 bit long integers, so that test was removed.
* BUG: Make ``Generator._masked`` flag default to ``False``. (#13774)Bernardt Duvenhage2019-06-131-27/+26
| | | | | | | | * Flipped the _masked flag to correctly use Lemire's method as suggested in the comment. See related issue https://github.com/numpy/numpy/issues/13769. * Updated a selection of the unit tests for Lemire's method as opposed to masked rejection sampling. * Removed comments and prints used during testing.
* MAINT: Update PCG jump sizesKevin Sheppard2019-06-061-0/+14
| | | | | Update pcg jump sizes Wrap advance when too large
* BUG: Fix random.choice when probability is not C contiguous (#13716)jeremiedbb2019-06-062-0/+58
| | | * test, fix random.choice sum for non-contiguous
* BUG: Ensure Windows choice returns int32Kevin Sheppard2019-06-021-0/+11
| | | | | | Downcast from searchsorted on Windows to ensure int32 is returned closes #9867
* MAINT: Misc. typo fixes (#13664)luzpaz2019-05-311-1/+1
| | | | | | * DOC, MAINT: Misc. typo fixes Found via `codespell`
* BUG: Fix RandomState argument nameKevin Sheppard2019-05-291-0/+6
| | | | | | RandomState's argument must be named seed for backward compat closes #13669
* BUG/MAINT: Disallow non-native byteorder in random intsKevin Sheppard2019-05-282-0/+13
| | | | | | Warn that non-native byte order is not supported in randint and integers closes #13159
* Merge pull request #13163 from mattip/randomgenSebastian Berg2019-05-2825-12/+21793
|\ | | | | | | | | ENH: randomgen This merges randomgen into numpy, which was originally developed at https://github.com/bashtage/randomgen and provides a new and improved API for random number generation with much new and improved functionality.
| * MAINT: fix for dtype specificationmattip2019-05-282-4/+4
| |
| * STY: Clean up codeKevin Sheppard2019-05-275-67/+89
| | | | | | | | | | | | Pep8 fixes Remove unused imports Fix name error
| * Revert "MAINT: Implement API changes for randomgen-derived code"Kevin Sheppard2019-05-276-2/+4106
| | | | | | | | This reverts commit 17e0070df93f4262908f884dca4b08cb7d0bba7f.
| * MAINT: Remove remnants of bit generatorsKevin Sheppard2019-05-277-6007/+1
| | | | | | | | | | Remove traces of the three removed bit generators Add lock to Cython examples
| * BUG: Change renamed attributeKevin Sheppard2019-05-231-1/+1
| | | | | | | | Change renamed attribute
| * MAINT: Remove test_against_numpyKevin Sheppard2019-05-231-557/+0
| | | | | | | | Remove test file that is circular when randomgen is in numpy
| * ENH: Split poisson_lam_maxKevin Sheppard2019-05-233-3/+4
| | | | | | | | | | | | Use type-dependent poisson lam max Make private Fix backward compat issue in loggam
| * MAINT: remove tomaxint, random_sample from generatormattip2019-05-233-28/+0
| |
| * BUG: test, fix missing return to deprecated functionmattip2019-05-231-1/+8
| |
| * MAINT: remove threefry32, xoroshiro128, xorshift1024 BitGeneratorsmattip2019-05-202-96/+6
| |
| * BUG: Ensure integer-type stream on 32bitKevin Sheppard2019-05-202-6/+65
| | | | | | | | | | | | Ensure integer type is stream compatible on 32 bit Fix incorrect clause end Add integer-generator tests that check long streams
| * MAINT: Implement API changes for randomgen-derived codemattip2019-05-2015-4839/+619
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | remove numpy.random.gen, BRNG.generator, pcg*, rand, randn remove use_mask and Lemire's method, fix benchmarks for PCG removal convert brng to bitgen (in C) and bit_generator (in python) convert base R{NG,andom.*} to BitGenerator, fix last commit randint -> integers, remove rand, randn, random_integers RandomGenerator -> Generator, more "basic RNG" -> BitGenerator random_sample -> random, jump -> jumped, resync with randomgen Remove derived code from entropy Port over changes accepted in upstream to protect log(0.0) where relevant fix doctests for jumped, better document choice Remove Python 2.7 shims Use NPY_INLINE to simplify Fix performance.py to work Renam directory brng to bit_generators Fix examples wiht new directory structure Clarify relationship to historical RandomState Remove references to .generator Rename xoshiro256/512starstar
| * ENH: Add closed generator to randintKevin Sheppard2019-05-202-74/+117
| | | | | | | | Add closed option to randint to simplify some cases
| * BUG: Cast high to Python int to avoid overflowKevin Sheppard2019-05-201-0/+8
| | | | | | | | Case high to a Python int to avoid overflow from NumPy types
| * ENH: Add fast path for randint broadcastingKevin Sheppard2019-05-202-1/+31
| | | | | | | | | | | | Add path that voids object conversion unless essential Small doc cleanups related to random_integers PEP-8 cleanups
| * ENH: Finish hypergeometric 0Kevin Sheppard2019-05-201-2/+2
| | | | | | | | | | | | Add changes to alow hypergeometric 0 Small syncs and cleanups Move legacy_distributions.pxd to legacy folder can be deleted
| * ENH: Improvce choice without replacementKevin Sheppard2019-05-202-5/+28
| | | | | | | | | | | | | | | | | | | | Improve performance in all cases Large improvement with size is small xref numpy/numpy#5299 xref numpy/numpy#2764 xref numpy/numpy#9855 xref numpy/numpy#7810
| * MAINT: Simplify return typesKevin Sheppard2019-05-202-0/+13
| | | | | | | | | | | | Standardize returns types for Windows and 32-bit platforms on int64 in choice and randint (default). Refactor tomaxint to call randint
| * ENH: Extend multinomial and fix zipfKevin Sheppard2019-05-202-8/+30
| | | | | | | | | | | | Extend multinomial to allow broadcasting Fix zipf changes missed in NumPy Enable 0 as valid input for hypergeometric
| * BENCH: convert bencmarks to asv formatmattip2019-05-2030-0/+28350
| | | | | | | | | | | | | | remove files that were part of the origal repo rework randomgen docs to integrate with numpy and fix some links remove convenience functions, require explicit call to gen.brng move code out of numpy.random.randomgen into numpy.random
* | Deprecate collapsing shape-1 dtype fields to scalars.Antony Lee2019-05-241-2/+1
| | | | | | | | | | | | | | | | | | Currently, a field specified as `[(name, dtype, 1)]` is interpreted as a scalar field (i.e., the same as `[(name, dtype)]` or `[(name, dtype, ()]`). This now raises a FutureWarning; in a future version, it will be interpreted as a shape-(1,) field, i.e. the same as `[(name, dtype, (1,))]` (consistently with `[(name, dtype, n)]` with `n>1`, which is already equivalent to `[(name, dtype, (n,)]`).
* | MAINT: Fix errors seen on new python 3.8Sebastian Berg2019-05-211-2/+4
|/ | | | | | | | | | | | | | One of this is a small issue exposed by new warnings, the others are simply adapting our test suit to stricter integer coercion rules (avoiding float -> int conversions). The last one is that we assumed pickle protocol 5 would be in 3.8. It is not yet included in the alpha releases at least. It seems not necessary for the numpy test suit to check whether it is available based on the python version so removing that test. (Also testing if the pickle5 module works seems unnecessary.) Closes gh-13412
* Merge pull request #12547 from bashtage/mvnormal-tol-checkAllan Haldane2019-03-211-0/+6
|\ | | | | ENH: Cast covariance to double in random mvnormal
| * ENH: Cast covariance to double in random mvnormalKevin Sheppard2018-12-141-0/+6
| | | | | | | | | | | | | | Cast the covariance in the multivariate normal to double so that the interpretation of tol is cleaner. closes #10839
* | Added issue number in commentBharat123Rox2019-03-051-0/+1
| |
* | Added more tests as suggested by @eric-wieserBharat123Rox2019-03-051-0/+2
| |
* | Fix #13087 by raising a ValueError and adding a unit test for itBharat123Rox2019-03-051-0/+1
| |
* | DOC: Fix Wald docstringKevin Sheppard2019-02-181-0/+2
| | | | | | | | | | Fix Wald Docstring to reflect actual restriction on parameters Add a test to ensure these are enforced for scalar inputs
* | BUG: Ensure probabilities are not NaN in choiceKevin Sheppard2018-12-141-0/+5
|/ | | | | | Add a check for NaN probabilities in random.choice closes #11250
* BUG: random: Fix handling of a=0 for numpy.random.weibull.Warren Weckesser2018-11-121-1/+2
| | | | | | | Before this fix, np.random.weibull(a=0) often returned inf (and in theory could have returned 1). It should only return 0. Closes gh-12371.
* Merge pull request #11771 from asnasnasn/shuf-mmMatti Picus2018-10-121-0/+4
|\ | | | | BUG: Make `random.shuffle` work on 1-D instances of `ndarray` subclasses