summaryrefslogtreecommitdiff
path: root/numpy/random/generator.pyx
Commit message (Collapse)AuthorAgeFilesLines
* API: move bit_generator and generator to be privatemattip2019-10-111-4124/+0
|
* API: refactor function names in distribution.{h,c}, refactor float_fillmattip2019-10-111-20/+23
|
* API: make BitGenerators privatemattip2019-10-111-1/+1
|
* API: rename common, bounded_integers -> _common, _bounded_integers; cleanupmattip2019-10-111-3/+3
|
* API: rearrange the cython files in numpy.randommattip2019-10-111-22/+113
|
* BUG: random: Use correct length when axis is given to shuffle.Warren Weckesser2019-10-081-3/+3
| | | | | | | When an axis argument was given, shuffle was using the original length of the array instead of the length of the given axis. This meant that, for example, if an array with shape (2, 10) was shuffled with axis=1, only the first two columns were shuffled.
* BUG: Avoid ctypes in GeneratorsKevin Sheppard2019-09-181-2/+2
| | | | | | Avoid unnecessary use of ctypes in Generators closes #14131
* ENH: Improve permutation and shuffle functions on a given axisKexuan Sun2019-09-141-14/+34
|
* BUG: Fix segfault in `random.permutation(x)` when x is a string. (#14241)Maxwell Aladago2019-08-221-2/+8
| | | | | | | | | | | | | | | | | | | | | | * fixing segfault error in np.random.permutation(x) where x is str * removed whitespace * changing error type to ValueError * changing error type to ValueError * changing error type to ValueError * tests * changed error to IndexError for backward compatibility with numpy 1.16 * fixes numpy.randomstate.permutation segfault too * Rolled back to ValueError for Generator.permutation() for all 0-dimensional * fixes refuige erro and rolls backs to AxisError
* Merge pull request #13812 from thrasibule/fast_floydCharles Harris2019-07-131-28/+60
|\ | | | | MAINT: Rewrite Floyd algorithm
| * add shuffle keywordGuillaume Horel2019-07-111-4/+11
| |
| * nogilGuillaume Horel2019-07-111-1/+1
| |
| * extra shuffle at the end and tweak heuristicGuillaume Horel2019-07-111-1/+2
| |
| * faster shuffleGuillaume Horel2019-07-111-8/+27
| |
| * prevent warningsGuillaume Horel2019-07-111-4/+4
| |
| * no wraparoundGuillaume Horel2019-07-111-1/+1
| |
| * use typed memoryview instead of C arrayGuillaume Horel2019-07-111-8/+3
| |
| * Rewrite Floyd algorithmGuillaume Horel2019-07-111-17/+27
| | | | | | | | | | - use a simple hash table with linear probing - adjust heuristic
* | DOC: emphasize random API changesmattip2019-07-091-8/+2
|/
* ENH: Rename default_gen to default_rngRobert Kern2019-06-291-44/+44
|
* BUG: Ensure consistent interpretation of uint64 states. (#13861)Robert Kern2019-06-281-1/+3
| | | * BUG: test, fix for big-endian systems
* ENH: np.random.default_gen() (#13840)Robert Kern2019-06-281-142/+154
| | | * ENH: Rename seed_seq argument to seed and replace Generator() with default_gen()
* MAINT: remove xoshiro* BitGeneratorsmattip2019-06-261-2/+2
|
* MAINT: random: Rewrite the hypergeometric distribution.Warren Weckesser2019-06-141-2/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-1/+1
| | | | | | | | * 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.
* Reduced line length.bduvenhage2019-06-131-1/+2
|
* DOC: Update of reference to paper for Lemire's method. Replaced with 2019 ↵bduvenhage2019-06-131-1/+1
| | | | journal reference as per Lemire's website; same arxiv link.
* BUG: Fix random.choice when probability is not C contiguous (#13716)jeremiedbb2019-06-061-3/+6
| | | * test, fix random.choice sum for non-contiguous
* MAINT: Remove version added from GeneratorKevin Sheppard2019-06-011-5/+0
| | | | Remove version added from Generator since this makes no sense
* MAINT: Misc. typo fixes (#13664)luzpaz2019-05-311-1/+1
| | | | | | * DOC, MAINT: Misc. typo fixes Found via `codespell`
* BUG/MAINT: Disallow non-native byteorder in random intsKevin Sheppard2019-05-281-1/+7
| | | | | | Warn that non-native byte order is not supported in randint and integers closes #13159
* STY: Clean up codeKevin Sheppard2019-05-271-1/+1
| | | | | | Pep8 fixes Remove unused imports Fix name error
* DOC: Add __all__ and document lockKevin Sheppard2019-05-271-0/+12
| | | | | Add docstring for lock Use __all__ to discuorage unless attributes from appearing
* ENH: Split poisson_lam_maxKevin Sheppard2019-05-231-1/+1
| | | | | | Use type-dependent poisson lam max Make private Fix backward compat issue in loggam
* MAINT: remove tomaxint, random_sample from generatormattip2019-05-231-50/+0
|
* BUG: test, fix missing return to deprecated functionmattip2019-05-231-1/+1
|
* MAINT: remove threefry32, xoroshiro128, xorshift1024 BitGeneratorsmattip2019-05-201-3/+3
|
* MAINT: Implement API changes for randomgen-derived codemattip2019-05-201-463/+260
| | | | | | | | | | | | | | | | | | | | | 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-201-15/+23
| | | | Add closed option to randint to simplify some cases
* ENH: Add fast path for randint broadcastingKevin Sheppard2019-05-201-5/+10
| | | | | | 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-6/+4
| | | | | | Add changes to alow hypergeometric 0 Small syncs and cleanups Move legacy_distributions.pxd to legacy folder can be deleted
* DOC: fix doctests, move numpy.random -> numpy.random.gen in generator.pyxmattip2019-05-201-98/+99
|
* ENH: Improvce choice without replacementKevin Sheppard2019-05-201-17/+78
| | | | | | | | | | 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-201-21/+6
| | | | | | 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-201-22/+49
| | | | | | Extend multinomial to allow broadcasting Fix zipf changes missed in NumPy Enable 0 as valid input for hypergeometric
* BUG: __dealloc__ can be called without __init__ in some error modesmattip2019-05-201-24/+27
| | | | | | skip doctests that require scipy move original mtrand module to _mtrand adjust documentation for namespace change
* BENCH: convert bencmarks to asv formatmattip2019-05-201-0/+4091
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