mercredi 10 août 2022

Generating Number from a given set with given probability in Matlab

I need to generate 5 integer number which must be from a given set of numbers {1,2,4,8,16}.

I need different values to have different probabilities of generating eg.

0.10 chance of 1
0.15 chance of 2
0.30 chance of 4 
0.25 chance of 8
0.20 chance of 16

How can I do this in Matlab?




Aucun commentaire:

Enregistrer un commentaire