mardi 31 janvier 2017

Choose an object randomly with different probability

I have the following problem:

I need to choose a random object from an ArrayList. This is simple, if all elements would have the same chance to be picked.

In my case, the chance of an object beeing picked is stored in another ArrayList. So I need a method, that randomly picks an element from the list based on the other ArrayList.

Thank you for any advice.




Aucun commentaire:

Enregistrer un commentaire