Returns an index of the weights, with the proportional odds given by the weights.
So weightedChoice([1, 2, 1]) is twice as likely to return 1 as it is 0 or 2.
See Implementation
Added April 19, 2025
Returns an index of the weights, with the proportional odds given by the weights.
So weightedChoice([1, 2, 1]) is twice as likely to return 1 as it is 0 or 2.