Documentation ¶
Overview ¶
Package rand random digit
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SelectWeightedRandItem ¶
func SelectWeightedRandItem(scalableRand *ScalableRand, slice WeightedSlice) int
SelectWeightedRandItem 通过随机权重算法选择值
Types ¶
type ScalableRand ¶
type ScalableRand struct {
// contains filtered or unexported fields
}
ScalableRand 可水平扩展的随机数发生器
type WeightedSlice ¶
type WeightedSlice interface { search.SearchableSlice // TotalWeight 获取总权重值 TotalWeight() int }
WeightedSlice 带权重的数组
Click to show internal directories.
Click to hide internal directories.