weighted_choice#

weighted_choice(mapping, seed=None)[source]#

Returns a single element from a weighted sample.

The input is a dictionary of items with weights as values.