classification
Title: _randbelow_with_getrandbits may request an unnecessary random bit
Type: resource usage Stage: resolved
Components: Library (Lib) Versions: Python 3.11
process
Status: closed Resolution: duplicate
Dependencies: Superseder: _randbelow_with_getrandbits function inefficient with powers of two
View: 37000
Assigned To: Nosy List: lormuc, mark.dickinson
Priority: normal Keywords:

Created on 2021-07-09 20:46 by lormuc, last changed 2021-07-12 20:00 by mark.dickinson. This issue is now closed.

Messages (2)
msg397219 - (view) Author: (lormuc) * Date: 2021-07-09 20:46
For example, Lib/random.py/Random._randbelow_with_getrandbits(1) should always return 0, as per docstring, but it asks for 1 random bit from getrandbits().
msg397225 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2021-07-09 21:09
See #37000 for previous discussion.
History
Date User Action Args
2021-07-12 20:00:39mark.dickinsonsetsuperseder: _randbelow_with_getrandbits function inefficient with powers of two
resolution: duplicate
2021-07-09 21:37:33lormucsetstatus: open -> closed
stage: resolved
2021-07-09 21:09:07mark.dickinsonsetnosy: + mark.dickinson
messages: + msg397225
2021-07-09 20:46:32lormuccreate