[New-bugs-announce] [issue35094] Improved algorithms for random.sample

Paul Crowley report at bugs.python.org
Sun Oct 28 15:00:35 EDT 2018


New submission from Paul Crowley <python at paul.ciphergoth.org>:

random.sample currently uses either a Fisher-Yates shuffle, or rejection sampling, to achieve sampling without replacement. I propose using reservoir sampling or "cardchoose"; these are similar performance or sometimes faster, and don't need to allocate anything except the list used for the results.

----------
components: Library (Lib)
messages: 328728
nosy: ciphergoth
priority: normal
severity: normal
status: open
title: Improved algorithms for random.sample
type: resource usage
versions: Python 3.8

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


More information about the New-bugs-announce mailing list