summaryrefslogtreecommitdiff
path: root/numpy/random/mtrand
Commit message (Collapse)AuthorAgeFilesLines
* BUG: Missing dirichlet input validationKevin Sheppard2017-08-171-0/+7
| | | | | | | | Dirichlet does not validate inputs and hangs when values are zero. Adds check that values are strictly positive as required by the distribution. closes #2089
* DOC: BLD: fix lots of Sphinx warnings/errors.Ralf Gommers2017-06-101-2/+2
|
* BUG: Buttress handling of extreme values in randintgfyoung2017-05-091-5/+16
|
* Merge pull request #8962 from MSeifert04/random_choice_docsEric Wieser2017-04-261-2/+2
|\ | | | | DOC: Wrong return type of np.random.choice and wrong variable name in parameter description.
| * DOC: Wrong return type of np.random.choice and wrong variable nameMichael Seifert2017-04-201-2/+2
| | | | | | | | | | | | in parameter description. [ci skip]
* | [DOC] use of * instead of ` to refer to a function parameter.Matthias Bussonnier2017-04-261-2/+2
|/ | | | | It's funny because it's fine in EXAMPLE_DOCSTRING.rst.txt that uses the same example.
* MAINT: avoid memcpy when i == jYu Feng2017-04-101-0/+1
| | | | | | | | | | | | Valgrind complains about memcpy with overlapping address in mtrand.c It happens when i == j in this loop. Closer inspection the i == j iteration is not needed (it is a swap). So, skip it and avoid depending on undefined behavior of memcpy. related read: https://sourceware.org/bugzilla/show_bug.cgi?id=12518
* BUG: Check for errors when PyInt_AsLong is called in np.randomSimon Gibbons2017-04-021-1/+1
| | | | | | | | | After #8883 was merged it was noticed that the same problem was occuring with calls to PyInt_AsLong. Namely that PyErr_Occoured wasn't being checked if it returned -1 indicating an exception could have been thrown. This PR adds those checks as well as a regression test.
* BUG: Ensure Errors are correctly checked when PyFloat_AsDouble is called.Simon Gibbons2017-04-011-1/+1
| | | | | | | | | | | | | | There was an error in np.random.uniform where if np.random.uniform were called with a type that throwed exceptions when it was converted to a float this exception wouldn't be raised. This bug was due to an issue where PyFloat_AsDouble was called but no check for PyErr_Occurred was performed after. This PR fixes the issue by ensuring that Cython will always emit a call to PyErr_Occurred if PyFloat_AsDouble returns -1.0 Fixes: #8865
* Revert gh-8570.Charles Harris2017-03-131-2/+1
| | | | | | | | BUG: fix issue #8250 where np.random.permutation fail. This reverts commit 7a73bad2d9c04e4f16e87dbed9d7b627327fe814. Closes #8776.
* BUG: fix issue #8250 where np.random.permutation fails when np.array gets ↵Evan Limanto2017-03-101-1/+2
| | | | called on an invalid sequence.
* single too argument + mention in release docs.Oscar Villellas2017-01-031-9/+5
|
* Documentation fix and proper handling of toleranceOscar Villellas2017-01-031-10/+15
|
* Merge remote-tracking branch 'numpy-org/master' into mult-normOscar Villellas2017-01-037-677/+1172
|\
| * DOC: Fixed minor typoMikhail Pak2016-12-131-1/+1
| |
| * BUG: Better check for invalid bounds in np.random.uniform.Alistair Muldal2016-11-021-0/+4
| | | | | | | | Also check for invalid bounds when low= and high= are arraylike rather than scalar (closes #8226)
| * DOC: Clean up lomax and genpareto references.wrwrwr2016-10-281-3/+3
| |
| * MAINT, DOC: Update some scipy.stats references.wrwrwr2016-10-281-27/+27
| | | | | | | | Closes #5813.
| * DOC: 'highest' is exclusive for randint()Ben North2016-10-201-2/+2
| |
| * MAINT: Remove duplicate randint helpers code.gfyoung2016-09-231-277/+0
| | | | | | | | | | Continuation of gh-8071 by removing the duplicate randint Cython code that is not generated via Tempita.
| * MAINT: Add Tempita to randint helpersgfyoung2016-09-202-0/+78
| | | | | | | | | | | | Refactors the randint helpers to use a Tempita template. This will reduce technical debt in the long run.
| * DOC: change version references from x.y to x.y.zPierre de Buyl2016-09-071-1/+1
| |
| * DOC: change Numpy to NumPy in dosctrings and commentsPierre de Buyl2016-09-061-1/+1
| | | | | | | | The strings in error messages were left untouched
| * Merge pull request #5822 from anntzer/0-scale-distributionsNathaniel J. Smith2016-06-221-60/+48
| |\ | | | | | | Allow many distributions to have a scale of 0.
| | * Don't allow -0. as distribution shape parameter.Antony Lee2016-06-091-24/+24
| | | | | | | | | | | | At least the gamma generator doesn't support it.
| | * Allow many distributions to have a scale of 0.Antony Lee2016-04-061-60/+48
| | | | | | | | | | | | | | | | | | (in which case a stream of 0's is usually returned (or 1's)). See #5818.
| * | DOC: add reference to poisson rngJulian Taylor2016-06-131-0/+5
| | | | | | | | | | | | [ci skip]
| * | BUG: Fix segfaults in np.random.shuffleSimon Gibbons2016-06-101-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | np.random.shuffle will allocate a buffer based on the size of the first element of an array of strings. If the first element is smaller than another in the array this buffer will overflow, causing a segfault when garbage is collected. Additionally if the array contains objects then one would be left in the buffer and have it's refcount erroniously decrimented on function exit, causing that object to be deallocated too early. To fix this we change the buffer to be an array of int8 of the the size of the array's dtype, which sidesteps both issues. Fixes #7710
| * | DOC: fix incorrect Gamma distribution parameterization commentsstevenjkern2016-05-051-2/+2
| | |
| * | MAINT: Always use PyCapsule instead of PyCObject in mtrand.pyx.Charles Harris2016-04-104-98/+11
| |/ | | | | | | | | | | Python 2.7 has a backport of PyCapsule so we no longer need to support PyCObject. This PR makes that change and removes the no longer needed mt_compat.h file.
| * DOC: Clarify the valid range of integers passed to random.seed.Charles Harris2016-02-271-6/+6
| |
| * DOC: Update random.seed in mtrand.pyx.Oren Amsalem2016-02-271-1/+1
| | | | | | | | | | | | | | I know int is between 0 and 4294967295, but I think many people that do not know that will benefit from this comment. [ci skip]
| * Merge pull request #7279 from madphysicist/percentile-testsJulian Taylor2016-02-231-2/+5
| |\ | | | | | | TST: Fixed elements being shuffled
| | * TST: Fixed shuffle axis in tests.Joseph Fox-Rabinovitz2016-02-221-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | Since shuffle only works along the first dimension, it must be done before reshape to get reasonable looking data. Did not affect the current tests. I noticed while working on some scipy code. Also, made a couple of doc changes to np.random.shuffle.
| * | BUG: Remove data race in mtrand: two threads could mutate the state.Devin Jeanpierre2016-02-221-9/+27
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | E.g.: np.random.random_sample() uses the GIL for synchronization np.random.random_sample(1) releases the GIL and uses a separate lock. This means that both can run simultaneously, causing a data race when mutating the random number generator's state, which could lead to buffer overflow (from incrementing state->pos). The fix here is to always use the separate lock, so that exactly one thread at a time is mutating the random number generator's state.
| * BUG: Make randint backwards compatible with pandasgfyoung2016-02-191-3/+9
| | | | | | | | | | | | | | | | | | | | The 'pandas' library expects Python integers to be returned, so this commit changes the API so that the default is 'np.int' which converts to native Python integer types when a singleton is being generated with this function. Closes gh-7284.
| * BUG: Enforce dtype for randint singletonsgfyoung2016-02-161-9/+9
| | | | | | | | Closes gh-7203.
| * DOC: fix a number of reST formatting issues in docstrings.Ralf Gommers2016-02-131-3/+5
| |
| * Update Wikipedia references for mtrand.pyxArne de Laat2016-02-021-12/+12
| | | | | | | | Specifically the 'Logarithmic distribution' link is fixed. For others the links or article names are updated.
| * DOC: Clarify behavior in np.random.uniformgfyoung2016-01-251-0/+6
| | | | | | | | | | | | | | | | | | | | Although the arguments are specified as 'high' and 'low', it is possible to pass in values for 'low' and 'high' where 'low' >= 'high' and still obtain well-defined behavior. The documentation has been expanded to reflect this fact, with a note to discourage passing in arguments satisfying 'low' > 'high'.
| * BUG: One element array inputs get one element arrays returned in np.randomgfyoung2016-01-241-187/+188
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes bug in np.random methods that would return scalars when passed one-element array inputs. This is because one-element ndarrays can be cast to integers / floats, which is what functions like PyFloat_AsDouble do before converting to the intended data type. This commit changes the check used to determine whether the inputs are purely scalar by converting all inputs to arrays and checking if the resulting shape is an empty tuple (scalar) or not (array). Closes gh-4263.
| * DOC: Clarified output size for broadcastable mtrand.pyx functionsgfyoung2016-01-231-182/+243
| | | | | | | | | | | | | | Clarified the output size depending on whether scalar or non-scalar inputs are passed to functions in mtrand.pyx that can broadcast their arguments.
| * TST: Added broadcasting tests in test_random.pygfyoung2016-01-231-6/+9
| | | | | | | | | | | | Added a whole new suite of tests to ensure that functions in mtrand.pyx which are broadcastable actually broadcast their arguments properly.
| * MAINT: Simplified mtrand.pyx helpersgfyoung2016-01-201-104/+74
| | | | | | | | | | | | | | Refactored methods that broadcast arguments together by finding additional common ground between code in the if...else branches that involved a size parameter being passed in.
| * Top shuffle speed for machine-sized ints/floats.Antony Lee2016-01-161-8/+18
| | | | | | | | | | | | Apparently gcc only specializes one branch (the last one) so I went for another 33% performance increase (matching #6776) in what's likely the most common use case.
| * MAINT: memcpy-based ~4x faster, typed shuffle.Antony Lee2016-01-161-17/+28
| | | | | | | | | | | | | | | | | | | | | | | | Only for 1d-ndarrays exactly, as subtypes (e.g. masked arrays) may not allow direct shuffle of the underlying buffer (in fact, the old implementation destroyed the underlying values of masked arrays while shuffling). Also handles struct-containing-object 1d ndarrays properly. See #6776 for an earlier, less general (but even faster: ~6x) improvement attempt, #5514 for the original issue.
| * DEP: Deprecate random_integersgfyoung2016-01-101-0/+12
| |
| * DOC: high arg is mandatory for mtrand._rand_int32ldoddema2016-01-041-7/+3
| |
| * MAINT: Fix notation in mtrand.pyx documentation.ldoddema2016-01-041-2/+2
| |
| * MAINT: Fix typos in 1.11.0-notes.rst and mtrand.pyx documentation.Charles Harris2016-01-031-1/+1
| |