Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Doc/library/random.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ lognormal, negative exponential, gamma, and beta distributions. For generating
distributions of angles, the von Mises distribution is available.

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
uses the Mersenne Twister as the core generator. It produces 53-bit precision
generates a random float uniformly in the half-open range ``0.0 <= X < 1.0``.
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
both fast and threadsafe. The Mersenne Twister is one of the most extensively
tested random number generators in existence. However, being completely
Expand Down Expand Up @@ -294,7 +294,7 @@ be found in any statistics text.

.. 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)
Expand Down
2 changes: 1 addition & 1 deletion Lib/random.py
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,7 @@ class SystemRandom(Random):
"""

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

def getrandbits(self, k):
Expand Down