(rng: () => number, arr: readonly T[])
| 37 | } |
| 38 | |
| 39 | function pick<T>(rng: () => number, arr: readonly T[]): T { |
| 40 | return arr[Math.floor(rng() * arr.length)]! |
| 41 | } |
| 42 | |
| 43 | function rollRarity(rng: () => number): Rarity { |
| 44 | const total = Object.values(RARITY_WEIGHTS).reduce((a, b) => a + b, 0) |