假设我有一个由字符串和它们出现的百分比组成的字典,如下所示:
{"a": 0.2, "b": 0.6, "c": 0.1, "d": 0.1}
我将如何使它返回"a" 20% of the time, "b" 60% of the time, 和"c" and "d" each 10% of the time?
"a" 20% of the time
"b" 60% of the time
"c" and "d" each 10% of the time
守着星空守着你
侃侃无极
相关分类