package
Version:
v0.5.0
Opens a new window with list of versions in this module.
Published: Nov 21, 2024
License: MIT
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
¶
func RandomBytes(length int) []byte
RandomBytes 生成指定长度的安全随机字节数组
func RandomEle[T any](list []T) T
RandomEle 从切片中随机返回一个元素
RandomEleSet 从切片中随机返回不重复的元素集,返回一个集合
RandomInt 生成一个 [min, max) 范围内的安全随机整数
RandomNumbers 生成指定长度的随机数字字符串
RandomString 生成指定长度的随机字符串(包含数字和字母)
func WeightRandom(items []Weighted) interface{}
WeightRandom 权重随机生成器,根据权重随机获取对象
type Weighted struct {
Item interface{}
Weight int64
}
Weighted 权重随机生成器结构
Source Files
¶
Click to show internal directories.
Click to hide internal directories.