From 684b3e0e44c40acb0aa52d829a8c9dcbe40cc03f Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Sat, 15 Oct 2022 11:50:25 -0500 Subject: [PATCH] Backport docstring improvement from 3.12 --- Lib/random.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Lib/random.py b/Lib/random.py index 1f3530e880fce2..f94616e048c554 100644 --- a/Lib/random.py +++ b/Lib/random.py @@ -282,10 +282,10 @@ def randbytes(self, n): ## -------------------- integer methods ------------------- def randrange(self, start, stop=None, step=_ONE): - """Choose a random item from range(start, stop[, step]). + """Choose a random item from range(stop) or range(start, stop[, step]). - This fixes the problem with randint() which includes the - endpoint; in Python this is usually not what you want. + Roughly equivalent to ``choice(range(start, stop, step))`` but + supports arbitrarily large ranges and is optimized for common cases. """