mirror of
https://github.com/python/cpython.git
synced 2025-10-07 07:31:46 +00:00
Issue #18844: Make the number of selections a keyword-only argument for random.choices().
This commit is contained in:
parent
22805ca54e
commit
9016f2864a
4 changed files with 27 additions and 23 deletions
|
@ -337,7 +337,7 @@ class Random(_random.Random):
|
|||
result[i] = population[j]
|
||||
return result
|
||||
|
||||
def choices(self, k, population, weights=None, *, cum_weights=None):
|
||||
def choices(self, population, weights=None, *, cum_weights=None, k=1):
|
||||
"""Return a k sized list of population elements chosen with replacement.
|
||||
|
||||
If the relative weights or cumulative weights are not specified,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue