Skip to content

Commit 8bcd4a6

Browse files
authored
GH-101097: Switch from standard interval notation to greater or less than signs for random.random()'s documentation (#101119)
1 parent 3e09f31 commit 8bcd4a6

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Doc/library/random.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ lognormal, negative exponential, gamma, and beta distributions. For generating
2121
distributions of angles, the von Mises distribution is available.
2222

2323
Almost all module functions depend on the basic function :func:`.random`, which
24-
generates a random float uniformly in the semi-open range [0.0, 1.0). Python
25-
uses the Mersenne Twister as the core generator. It produces 53-bit precision
24+
generates a random float uniformly in the half-open range ``0.0 <= X < 1.0``.
25+
Python uses the Mersenne Twister as the core generator. It produces 53-bit precision
2626
floats and has a period of 2\*\*19937-1. The underlying implementation in C is
2727
both fast and threadsafe. The Mersenne Twister is one of the most extensively
2828
tested random number generators in existence. However, being completely
@@ -294,7 +294,7 @@ be found in any statistics text.
294294

295295
.. function:: random()
296296

297-
Return the next random floating point number in the range [0.0, 1.0).
297+
Return the next random floating point number in the range ``0.0 <= X < 1.0``
298298

299299

300300
.. function:: uniform(a, b)

Lib/random.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,7 @@ class SystemRandom(Random):
849849
"""
850850

851851
def random(self):
852-
"""Get the next random number in the range [0.0, 1.0)."""
852+
"""Get the next random number in the range 0.0 <= X < 1.0."""
853853
return (int.from_bytes(_urandom(7)) >> 3) * RECIP_BPF
854854

855855
def getrandbits(self, k):

0 commit comments

Comments
 (0)