[New-bugs-announce] [issue18888] Add stdlib support for random sampling with replacement

Madison May report at bugs.python.org
Sat Aug 31 02:23:49 CEST 2013


New submission from Madison May:

Although the random module supports random sampling without replacement, there is no support for random sampling with replacement.  Efficient random sampling with replacement is trivial using random.choice() (see below), but supporting it as an optional 'replace' arg to random.sample() might be nice for symmetry. 

array = range(100)
random_sample = [random.choice(array) for i in range(10)]

----------
components: Library (Lib)
messages: 196603
nosy: madison.may
priority: normal
severity: normal
status: open
title: Add stdlib support for random sampling with replacement
type: enhancement
versions: Python 3.4, Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18888>
_______________________________________


More information about the New-bugs-announce mailing list