diff options
author | Arushi Sharma <40266350+arushi-08@users.noreply.github.com> | 2021-10-26 23:03:49 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-26 10:33:49 -0700 |
commit | 58a9038da7e0e76e423cf56434a179620bc0dcb9 (patch) | |
tree | e05c62057589d0721677da5e6127a08288367a8a /numpy | |
parent | e262f88f93f2b282a7c5d5f48ab6e21123f32dae (diff) | |
download | numpy-58a9038da7e0e76e423cf56434a179620bc0dcb9.tar.gz |
DOC: Updated random.uniform docstring parameter description (#20146)
Add note to the description of the \"high\" parameter to indicate that it is possible
for the value to be included in the returned values due to floating point precision, despite
the fact that it represents an open interval.
Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/random/_generator.pyx | 6 | ||||
-rw-r--r-- | numpy/random/mtrand.pyx | 5 |
2 files changed, 8 insertions, 3 deletions
diff --git a/numpy/random/_generator.pyx b/numpy/random/_generator.pyx index 5bacb9f6f..54973100e 100644 --- a/numpy/random/_generator.pyx +++ b/numpy/random/_generator.pyx @@ -876,8 +876,10 @@ cdef class Generator: greater than or equal to low. The default value is 0. high : float or array_like of floats Upper boundary of the output interval. All values generated will be - less than high. high - low must be non-negative. The default value - is 1.0. + less than high. The high limit may be included in the returned array of + floats due to floating-point rounding in the equation + ``low + (high-low) * random_sample()``. high - low must be + non-negative. The default value is 1.0. 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 06e75a698..ca539c00e 100644 --- a/numpy/random/mtrand.pyx +++ b/numpy/random/mtrand.pyx @@ -1033,7 +1033,10 @@ cdef class RandomState: greater than or equal to low. The default value is 0. high : float or array_like of floats Upper boundary of the output interval. All values generated will be - less than or equal to high. The default value is 1.0. + less than or equal to high. The high limit may be included in the + returned array of floats due to floating-point rounding in the + equation ``low + (high-low) * random_sample()``. The default value + is 1.0. 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), |