method
Random.weighted
Random.weighted(weights: []int) -> int
Picks an index into weights with probability proportional to the weight (a weight of 0 is never picked); -1 when every weight is 0. Deterministic, from the seeded RNG. A loot table, a spawn roster, a random event.
Example
# doc-check: skip — illustrative let pick = roster[Random.weighted(weights: weights)]