Design a class Solution over an array w of non-negative integer weights, at least one of them positive.
new Solution(w, rng) prepares the picker. rng returns numbers in [0, 1). Do not change wpickIndex() returns index i with probability w[i] / sum(w). An index with weight 0 is never returned- Use prefix sums and a binary search: setup O(n), each pick O(log n), O(n) memory. Do not repeat each index
w[i] times - Each pick draws once:
r = Math.floor(rng() * total), then returns the first index whose prefix sum is strictly greater than r