The Python random.choices() function defaults to selecting an item uniformly from the collection, but optionally lets you specify a list (of the same size) of weights to make a weighted sample instead. I suspect that'll be fairly useful.
(It also lets you instead specify your weights as cumulative weights; I dunno if we really need to support both. Converting one to the other is trivial.)
The Python
random.choices()
function defaults to selecting an item uniformly from the collection, but optionally lets you specify a list (of the same size) of weights to make a weighted sample instead. I suspect that'll be fairly useful.(It also lets you instead specify your weights as cumulative weights; I dunno if we really need to support both. Converting one to the other is trivial.)