Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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
)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #random #sample #weights #python
ADD COMMENT
Topic
Name
4+8 =