dimanche 23 mai 2021

Choose one of N items given the probability of each item [duplicate]

I want to write a function that returns one out of N items, given the probability of each item (the sum of all probabilities is 1).

I found a lot of ways to do this in Python with numpy, but I'm interested in a JavaScript solution.

How do I do this?




Aucun commentaire:

Enregistrer un commentaire