mardi 4 juillet 2017

a better way to do random sampling with a probability distribution?

I want to choose random items from an array but with certain probability distributions. currently I do: myarray =[5,5,5,95] which gets me a 75% chance of getting a 5 and 25% chance of getting a 95.

I have a lot more numbers though and it takes too much time to write out all those numbers, is there a faster/better way to do this?




Aucun commentaire:

Enregistrer un commentaire