The highest tagged major version is
v2.
package
Version:
v1.8.20220610
Opens a new window with list of versions in this module.
Published: May 30, 2022
License: Apache-2.0
Opens a new window with license information.
Imports: 4
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
func Index(a interface{}) int
根据a[i]比重随机下标i
func IndexFunc(a interface{}, num int, randBase func(i int) int) []int
根据数组权重随机多个不重复的结果,返回数组下标
传入randBase的函数,是为了获取多个数组里面的基础概率
func IndexN(a interface{}, num int) []int
根据数组权重随机多个不重复的结果,返回数组下标
func Shuffle(a interface{})
随机打乱数组/切片
func ShuffleN(a interface{}, n int)
随机打乱切片或数组前n个元素
Source Files
¶
Click to show internal directories.
Click to hide internal directories.