mardi 10 mars 2015

Weighted Random Numbers in Python [duplicate]


This question already has an answer here:




I have to generate some random, but weighted, BMI data (to 2dp) in some Python code that is populating a database.. Whilst I am comfortable with random numbers the weighting has thrown me. The distribution is:-



15 – 19.99, 3%
20 – 24.99, 39%
25 – 29.99, 36%
30 – 34.99, 16%
35 – 40, 6%


Is there a technique for generating weighted random numbers?


Thank you...





Aucun commentaire:

Enregistrer un commentaire