[issue44080] Bias in random.choices(long_sequence)

Dennis Sweeney report at bugs.python.org
Sun May 9 13:06:46 EDT 2021


Dennis Sweeney <sweeney.dennis650 at gmail.com> added the comment:

Your suspicion looks correct, random() is faster:

.\python.bat -m pyperf timeit -s "from random import choices" "choices(range(100), k=10_000)"

Before int_choices.diff: Mean +- std dev: 1.49 ms +- 0.09 ms
After int_choices.diff:  Mean +- std dev: 3.50 ms +- 0.33 ms

----------
keywords: +patch
Added file: https://bugs.python.org/file50028/int_choices.diff

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44080>
_______________________________________


More information about the Python-bugs-list mailing list