Let's say I have an array probabilities = [0.1, 0.2, ..., 0.1, 0.4]
of n
elements. These are floating point values, not weights.
How do I extract a random integer from 1
to n
with the given probabilities in Ansi C?
probabilities = [0.1, 0.2, 0.1, 0.15, 0.05, 0.1, 0.4]
extract_random_integer(probabilities)
Aucun commentaire:
Enregistrer un commentaire