mirror of
https://github.com/python/cpython.git
synced 2025-08-23 18:24:46 +00:00
Rename weighted_choices() to just choices()
This commit is contained in:
parent
c98b26a6ac
commit
28aa4a0684
4 changed files with 32 additions and 32 deletions
|
@ -51,7 +51,7 @@ __all__ = ["Random","seed","random","uniform","randint","choice","sample",
|
|||
"randrange","shuffle","normalvariate","lognormvariate",
|
||||
"expovariate","vonmisesvariate","gammavariate","triangular",
|
||||
"gauss","betavariate","paretovariate","weibullvariate",
|
||||
"getstate","setstate", "getrandbits", "weighted_choices",
|
||||
"getstate","setstate", "getrandbits", "choices",
|
||||
"SystemRandom"]
|
||||
|
||||
NV_MAGICCONST = 4 * _exp(-0.5)/_sqrt(2.0)
|
||||
|
@ -337,7 +337,7 @@ class Random(_random.Random):
|
|||
result[i] = population[j]
|
||||
return result
|
||||
|
||||
def weighted_choices(self, k, population, weights=None, *, cum_weights=None):
|
||||
def choices(self, k, population, weights=None, *, cum_weights=None):
|
||||
"""Return a k sized list of population elements chosen with replacement.
|
||||
|
||||
If the relative weights or cumulative weights are not specified,
|
||||
|
@ -749,7 +749,7 @@ choice = _inst.choice
|
|||
randrange = _inst.randrange
|
||||
sample = _inst.sample
|
||||
shuffle = _inst.shuffle
|
||||
weighted_choices = _inst.weighted_choices
|
||||
choices = _inst.choices
|
||||
normalvariate = _inst.normalvariate
|
||||
lognormvariate = _inst.lognormvariate
|
||||
expovariate = _inst.expovariate
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue