import { WeightedRandomHelper } from "https://deno.land/x/sptaki@1.2.0/helpers/WeightedRandomHelper.d.ts";
Picks the random item based on its weight. The items with higher weight will be picked more often (with a higher probability).
For example:
- items = ['banana', 'orange', 'apple']
- weights = [0, 0.2, 0.8]
- weightedRandom(items, weights) in 80% of cases will return 'apple', in 20% of cases will return 'orange' and it will never return 'banana' (because probability of picking the banana is 0%)