samedi 20 février 2016

Generating random numbers that sum up to N and follow a discrete distribution

How can I generate random numbers from the set (1, 2, 3, 4, 5, 6) that add up to N and follow the probability distribution (0.3, 0.25, 0.25, 0.1, 0.05, 0.05) in Java?

UPDATE: I can use EnumeratedIntegerDistribution as proposed in this answer but this doesn't take into account that the numbers should add up to N.




Aucun commentaire:

Enregistrer un commentaire