mardi 3 novembre 2020

Generate list of numbers from a list with probability weights

How would one go about generating a random number from a list of 35 numbers with given probabilities:

Probability of number in range (1,5) - p1 = 0.5

Probability of number in range (6,15) - p2 = 0.25

Probability of number in range (16,35) - p3 = 0.25

I tried using numpy.random.choice() but I have no idea how to jam in possible lists of numbers.




Aucun commentaire:

Enregistrer un commentaire