bpo-42559: Not that getrandbits() is non-negative. (GH-23843) (GH-23851)

This commit is contained in:
Miss Islington (bot) 2020-12-18 19:10:06 -08:00 committed by GitHub
parent 782665885c
commit d458d8dab0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 4 deletions

View File

@ -142,10 +142,11 @@ Functions for integers
.. function:: getrandbits(k)
Returns a Python integer with *k* random bits. This method is supplied with
the MersenneTwister generator and some other generators may also provide it
as an optional part of the API. When available, :meth:`getrandbits` enables
:meth:`randrange` to handle arbitrarily large ranges.
Returns a non-negative Python integer with *k* random bits. This method
is supplied with the MersenneTwister generator and some other generators
may also provide it as an optional part of the API. When available,
:meth:`getrandbits` enables :meth:`randrange` to handle arbitrarily large
ranges.
.. versionchanged:: 3.9
This method now accepts zero for *k*.