weighted_choice#

weighted_choice(mapping, seed=None)[源代码]#

从加权样本返回单个元素。

输入是以权重为值的项的字典。