diff options
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/src/multiarray/dtypemeta.c | 4 | ||||
-rw-r--r-- | numpy/random/_generator.pyx | 11 | ||||
-rw-r--r-- | numpy/random/mtrand.pyx | 9 |
3 files changed, 18 insertions, 6 deletions
diff --git a/numpy/core/src/multiarray/dtypemeta.c b/numpy/core/src/multiarray/dtypemeta.c index b2f36d794..ddaf11042 100644 --- a/numpy/core/src/multiarray/dtypemeta.c +++ b/numpy/core/src/multiarray/dtypemeta.c @@ -162,12 +162,12 @@ void_discover_descr_from_pyobject( } if (PyBytes_Check(obj)) { PyArray_Descr *descr = PyArray_DescrNewFromType(NPY_VOID); - Py_ssize_t itemsize = (int)PyBytes_Size(obj); + Py_ssize_t itemsize = PyBytes_Size(obj); if (itemsize > NPY_MAX_INT) { PyErr_SetString(PyExc_TypeError, "byte-like to large to store inside array."); } - descr->elsize = itemsize; + descr->elsize = (int)itemsize; return descr; } PyErr_Format(PyExc_TypeError, diff --git a/numpy/random/_generator.pyx b/numpy/random/_generator.pyx index 1912f8bed..f25f16a8a 100644 --- a/numpy/random/_generator.pyx +++ b/numpy/random/_generator.pyx @@ -644,6 +644,12 @@ cdef class Generator: -------- integers, shuffle, permutation + Notes + ----- + Setting user-specified probabilities through ``p`` uses a more general but less + efficient sampler than the default. The general sampler produces a different sample + than the optimized sampler even if each element of ``p`` is 1 / len(a). + Examples -------- Generate a uniform random sample from np.arange(5) of size 3: @@ -3025,8 +3031,9 @@ cdef class Generator: Parameters ---------- lam : float or array_like of floats - Expectation of interval, must be >= 0. A sequence of expectation - intervals must be broadcastable over the requested size. + Expected number of events occurring in a fixed-time interval, + must be >= 0. A sequence must be broadcastable over the requested + size. size : int or tuple of ints, optional Output shape. If the given shape is, e.g., ``(m, n, k)``, then ``m * n * k`` samples are drawn. If size is ``None`` (default), diff --git a/numpy/random/mtrand.pyx b/numpy/random/mtrand.pyx index 40b3ea100..8d349b7d8 100644 --- a/numpy/random/mtrand.pyx +++ b/numpy/random/mtrand.pyx @@ -852,6 +852,10 @@ cdef class RandomState: Notes ----- + Setting user-specified probabilities through ``p`` uses a more general but less + efficient sampler than the default. The general sampler produces a different sample + than the optimized sampler even if each element of ``p`` is 1 / len(a). + Sampling random rows from a 2-D array is not possible with this function, but is possible with `Generator.choice` through its ``axis`` keyword. @@ -3524,8 +3528,9 @@ cdef class RandomState: Parameters ---------- lam : float or array_like of floats - Expectation of interval, must be >= 0. A sequence of expectation - intervals must be broadcastable over the requested size. + Expected number of events occurring in a fixed-time interval, + must be >= 0. A sequence must be broadcastable over the requested + size. size : int or tuple of ints, optional Output shape. If the given shape is, e.g., ``(m, n, k)``, then ``m * n * k`` samples are drawn. If size is ``None`` (default), |