Expand description
Weighted random selection helpers. Weighted selection over an arbitrary slice.
Functionsยง
- get_
random_ item - Picks an entry with probability proportional to its weight. A zero total
weight returns
Nonewithout consuming random values. - get_
total_ weight - Sums
weightoveritems. - get_
weighted_ item - Returns the entry whose cumulative weight range contains
index.