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 <rep...@bugs.python.org> <http://bugs.python.org/issue18888> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com