pick method
Picks 1 item, probability proportional to its compiled weight. No re-validation — that already happened once, at construction.
Implementation
T pick(Random random) {
final target = random.nextDouble() * _cumulative.last;
for (var i = 0; i < _items.length; i++) {
if (target < _cumulative[i]) return _items[i];
}
return _items.last; // floating-point rounding safety net
}