roulette(probabilities: number[] ): number

Returns the index of the item obtained given the probabilities

paramprobabilities- The probabilities.

// There is a 10% chance for index 0, 30% for index 1 and 60% for index 2 to be returned
roulette([0.1, 0.3, 0.6]);
roulette([10, 30, 60]);
// There is a 1/6 chance for index 0, 2/6 for index 1 and 4/6 for index 2 to be returned
roulette([1, 2, 4]);

returnsThe index of the item obtained given the probabilities

groupMath

subgroupRandom