Skip to content

Commit d458d8d

Browse files
bpo-42559: Not that getrandbits() is non-negative. (GH-23843) (GH-23851)
1 parent 7826658 commit d458d8d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Doc/library/random.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,11 @@ Functions for integers
142142

143143
.. function:: getrandbits(k)
144144

145-
Returns a Python integer with *k* random bits. This method is supplied with
146-
the MersenneTwister generator and some other generators may also provide it
147-
as an optional part of the API. When available, :meth:`getrandbits` enables
148-
:meth:`randrange` to handle arbitrarily large ranges.
145+
Returns a non-negative Python integer with *k* random bits. This method
146+
is supplied with the MersenneTwister generator and some other generators
147+
may also provide it as an optional part of the API. When available,
148+
:meth:`getrandbits` enables :meth:`randrange` to handle arbitrarily large
149+
ranges.
149150

150151
.. versionchanged:: 3.9
151152
This method now accepts zero for *k*.

0 commit comments

Comments
 (0)