randutil

package
v1.8.20220610 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 30, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Index

func Index(a interface{}) int

根据a[i]比重随机下标i

func IndexFunc added in v1.8.20220415

func IndexFunc(a interface{}, num int, randBase func(i int) int) []int

根据数组权重随机多个不重复的结果,返回数组下标 传入randBase的函数,是为了获取多个数组里面的基础概率

func IndexN

func IndexN(a interface{}, num int) []int

根据数组权重随机多个不重复的结果,返回数组下标

func IsPercentNice

func IsPercentNice(percent float64) bool

func Shuffle

func Shuffle(a interface{})

随机打乱数组/切片

func ShuffleN

func ShuffleN(a interface{}, n int)

随机打乱切片或数组前n个元素

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL