📌  相关文章
📜  带有权重的随机样本 python 代码示例

📅  最后修改于: 2022-03-11 14:46:14.993000             🧑  作者: Mango

代码示例1
import random

random.choices(
  population=[a, b, c, d],  # list to pick from
  weights=[0.2, 0.2, 0.2, 0.4],  # weights of the population, in order
  k=5  # amount of samples to draw
)