How to pick an item by its probability?
Generate a uniformly distributed random number. Iterate through your list until the cumulative probability of the visited elements is greater than the random number Sample code: double p = Math.random(); double cumulativeProbability = 0.0; for (Item item : items) { cumulativeProbability += item.probability(); if (p <= cumulativeProbability) { return item; } }