]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue 6261: Clarify behavior of random.uniform().
authorRaymond Hettinger <python@rcn.com>
Thu, 11 Jun 2009 23:14:12 +0000 (23:14 +0000)
committerRaymond Hettinger <python@rcn.com>
Thu, 11 Jun 2009 23:14:12 +0000 (23:14 +0000)
Doc/library/random.rst
Lib/random.py

index ecfa607e189a7be31cb2ea61da73c454cd78ad34..6c7a04dca44015a25c5e99bc9cc51d44f1438726 100644 (file)
@@ -142,6 +142,8 @@ be found in any statistics text.
    Return a random floating point number *N* such that ``a <= N <= b`` for
    ``a <= b`` and ``b <= N <= a`` for ``b < a``.
 
+   The end-point value ``b`` may or may not be included in the range
+   depending on floating-point rounding in the equation ``a + (b-a) * random()``.
 
 .. function:: triangular(low, high, mode)
 
index 9279d1d699a983875d9a8bf18085f6544d44a682..3c1fab213ab31723126d9a1983542bc5a55cd994 100644 (file)
@@ -333,7 +333,7 @@ class Random(_random.Random):
 ## -------------------- uniform distribution -------------------
 
     def uniform(self, a, b):
-        """Get a random number in the range [a, b)."""
+        "Get a random number in the range [a, b) or [a, b] depending on rounding."
         return a + (b-a) * self.random()
 
 ## -------------------- triangular --------------------