getKeysInWeightedRandomOrder

fun <T> Map<T, Double>.getKeysInWeightedRandomOrder(normalizer: Double, rand: Random): List<T>

Randomly sorts the items with respect to the current weight distribution. normalizer is used to normalize the random value obtained from rand to control how important the original weights are. With higher normalizer the importance of the random factor decreases.

Sources

Katlib source
Link copied to clipboard