Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WeightedChoice ¶
WeightedChoice takes a slice of positive weights, and returns a random index from [0, len(weights)) with probability of index i being proportional to weight i. Returns -1 for erroneous conditions like a weight being negative.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.