Answers for "random sample with weights python"

0

random sample with weights python

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
)
Posted by: Guest on November-04-2020

Python Answers by Framework

Browse Popular Code Answers by Language