diff options
author | mattip <matti.picus@gmail.com> | 2020-02-15 22:11:42 +0200 |
---|---|---|
committer | mattip <matti.picus@gmail.com> | 2020-02-15 22:11:42 +0200 |
commit | ca1b13224ba397ac3f77f48c899e2adcea1de5db (patch) | |
tree | aaba2b0fa45fe0bdf50a1fdb8e0235128afbb800 | |
parent | 1f9ab28a9ee5a0cda956da35d0c77a3a4c4bcd55 (diff) | |
download | numpy-ca1b13224ba397ac3f77f48c899e2adcea1de5db.tar.gz |
DOC: Document caveat in random.uniform
-rw-r--r-- | numpy/random/mtrand.pyx | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/numpy/random/mtrand.pyx b/numpy/random/mtrand.pyx index 3d0318752..6387814c8 100644 --- a/numpy/random/mtrand.pyx +++ b/numpy/random/mtrand.pyx @@ -1017,7 +1017,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), @@ -1053,7 +1053,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 -------- |