Example of uniform on random page appears to have the wrong comment

Hi! I'm a little confused. In the examples section of the docs for the random module it shows uniform(2.5, 10.0) # Random float: 2.5 <= x < 10.0 But the docs say random.uniform(a, b) Return a random floating point number N such that a <= N <= b for a <= b and b <= N <= a for b < a. So, shouldn't the example really say # Random float: 2.5 <= x <= 10.0 or am I not understanding random.uniform? Best wishes, Ted

Hi Theodore, Le 4/29/21 à 3:51 PM, Theodore Greene a écrit :
I'm a little confused. In the examples section of the docs for the random module it shows
uniform(2.5, 10.0) # Random float: 2.5 <= x < 10.0
But the docs say
random.uniform(a, b)
Return a random floating point number N such that a <= N <= b for a <= b and b <= N <= a for b < a.
So, shouldn't the example really say
# Random float: 2.5 <= x <= 10.0
or am I not understanding random.uniform?
Nice catch! I fixed the example in this PR: https://github.com/python/cpython/pull/25784 Bests, -- [Julien Palard](https://mdk.fr)
participants (2)
-
Julien Palard
-
Theodore Greene