weighted

static ResultSelector<Tweighted<T>(ToDoubleFunction<T> weightExtractor)

Creates a result selector that randomly selects an element where each element is given a specific weight based on the weight extractor function. The higher a weight, the more likely that element is to be chosen. The weights are all relative to each other. If one element has twice the weight of another, it's twice as likely to be chosen.

Return

a result selector that randomly selects an element where each element is given a specific weight based on the weight extractor function

Parameters

weightExtractor

the weight extraction algorithm

<T>

the result type