package
Version:
v0.2.9
Opens a new window with list of versions in this module.
Published: Jan 7, 2022
License: BSD-3-Clause
Opens a new window with license information.
Imports: 2
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
Intn 返回一个随机的整数,其值区间 [0, max)
RandInWeights 计算权重,并返回数组下标
Rate 返回一个随机的百分比概率,其值区间 [0, 1.0)
BaseWeights 将 []int 包装为 Weights 接口
Wrap 将 []int 包装为baseWeights
type Weights interface {
TotalLen() int
TotalWeight() int
GetWeight(int) int
}
Weights 权重列表
Source Files
¶
Click to show internal directories.
Click to hide internal directories.