python / cpython

The Python programming language
https://www.python.org
Other
62.69k stars 30.06k forks source link

`secrets.randbits` returns only nonnegative integers #123789

Closed Kodiologist closed 3 weeks ago

Kodiologist commented 3 weeks ago

Documentation

The docstring of secrets.randbits reads, in its entirety, "Return an int with k random bits." In fact, it only generates nonnegative integers, like its sister function random.getrandbits.

Linked PRs

AA-Turner commented 3 weeks ago

PR welcome!

A

Wulian233 commented 3 weeks ago

Now we can close this🎉

Kodiologist commented 3 weeks ago

Looks good. Thanks.