[3.11] GH-101097: Switch from standard interval notation to greater or less than signs for random.random()'s documentation (GH-101119) (GH-101246)

(cherry picked from commit 8bcd4a6ec7)

Co-authored-by: Andrew Hong <andrewhong@myyahoo.com>

Automerge-Triggered-By: GH:rhettinger
This commit is contained in:
Miss Islington (bot) 2023-01-22 13:45:55 -08:00 committed by GitHub
parent 8cf8a6820e
commit 69d12d868e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View file

@ -21,8 +21,8 @@ lognormal, negative exponential, gamma, and beta distributions. For generating
distributions of angles, the von Mises distribution is available. distributions of angles, the von Mises distribution is available.
Almost all module functions depend on the basic function :func:`.random`, which Almost all module functions depend on the basic function :func:`.random`, which
generates a random float uniformly in the semi-open range [0.0, 1.0). Python generates a random float uniformly in the half-open range ``0.0 <= X < 1.0``.
uses the Mersenne Twister as the core generator. It produces 53-bit precision Python uses the Mersenne Twister as the core generator. It produces 53-bit precision
floats and has a period of 2\*\*19937-1. The underlying implementation in C is floats and has a period of 2\*\*19937-1. The underlying implementation in C is
both fast and threadsafe. The Mersenne Twister is one of the most extensively both fast and threadsafe. The Mersenne Twister is one of the most extensively
tested random number generators in existence. However, being completely tested random number generators in existence. However, being completely
@ -273,7 +273,7 @@ be found in any statistics text.
.. function:: random() .. function:: random()
Return the next random floating point number in the range [0.0, 1.0). Return the next random floating point number in the range ``0.0 <= X < 1.0``
.. function:: uniform(a, b) .. function:: uniform(a, b)

View file

@ -794,7 +794,7 @@ class SystemRandom(Random):
""" """
def random(self): def random(self):
"""Get the next random number in the range [0.0, 1.0).""" """Get the next random number in the range 0.0 <= X < 1.0."""
return (int.from_bytes(_urandom(7)) >> 3) * RECIP_BPF return (int.from_bytes(_urandom(7)) >> 3) * RECIP_BPF
def getrandbits(self, k): def getrandbits(self, k):