core/utils/weighted_random_pick library

Functions

weightedRandomPick<T>(List<T> items, List<double> weights, {Random? random}) → T
Picks 1 item from items with probability proportional to the matching entry in weights — the shared loot-table/gacha-reward primitive so each new reward system (achievements, offline earnings, …) doesn't reimplement this. Pass a seeded random in tests for determinism.