-
-
Notifications
You must be signed in to change notification settings - Fork 30
Open
Description
I think it would be useful to have a weighted version of random.choice()
, that you could call like this:
random.weightedChoice([
["oneSixth", 1],
["oneThird", 2],
["oneHalf", 3]
]);
And it'd add up all the weights, and for each item, its probability of being returned is the ratio of its weight over the total weight.
If you're ok with adding this, I'd be happy to send in a PR.
transitive-bullshit
Metadata
Metadata
Assignees
Labels
No labels