The OpenD Programming Language

weightedChoice

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.

Meta

History

Added April 19, 2025