summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatti Picus <matti.picus@gmail.com>2019-05-19 18:57:07 +0300
committerGitHub <noreply@github.com>2019-05-19 18:57:07 +0300
commit5e46e3d05cbfb162e0decda6b306f4f62170b6a1 (patch)
tree27c2cdc8d7a317270045233e878e4f2c4d527995
parenta86c7e536d9c9dc564f538ce070c758cf7e2a127 (diff)
parentea4a9fd4683db123fef784871935ad906090ecce (diff)
downloadnumpy-5e46e3d05cbfb162e0decda6b306f4f62170b6a1.tar.gz
Merge pull request #13277 from kritisingh1/random
DOC: Document caveat in random.uniform
-rw-r--r--numpy/random/mtrand/mtrand.pyx11
1 files changed, 9 insertions, 2 deletions
diff --git a/numpy/random/mtrand/mtrand.pyx b/numpy/random/mtrand/mtrand.pyx
index c97c166aa..329d5cd68 100644
--- a/numpy/random/mtrand/mtrand.pyx
+++ b/numpy/random/mtrand/mtrand.pyx
@@ -1235,7 +1235,7 @@ 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 high. The default value is 1.0.
+ less than or equal to high. 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),
@@ -1270,7 +1270,14 @@ cdef class RandomState:
If ``high`` < ``low``, the results are officially undefined
and may eventually raise an error, i.e. do not rely on this
function to behave when passed arguments satisfying that
- inequality condition.
+ inequality condition. 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()``. For example:
+
+ >>> x = np.float32(5*0.99999999)
+ >>> x
+ 5.0
+
Examples
--------