Documentation ¶
Index ¶
- func Bool() bool
- func ChineseName() string
- func Dice() int
- func DiceN(n int) int
- func Duration(min int64, max int64) time.Duration
- func EnglishName() string
- func Float32() float32
- func Float64() float64
- func HostName() string
- func Int(min int, max int) int
- func Int64(min int64, max int64) int64
- func IntN(n int) int
- func Name() string
- func NumberString(min int, max int) string
- func NumberStringRepair(min int, max int) string
- func Probability(p int, full ...int) bool
- func ProbabilityChooseOne(ps ...int) int
- func RefreshSeed(seed ...int64)
- func WeightMap[K comparable, T any](getWeightHandle func(data T) int, data map[K]T) T
- func WeightSlice[T any](getWeightHandle func(data T) int, data ...T) T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NumberString ¶
NumberString 返回一个介于min和max之间的string类型的随机数。
func NumberStringRepair ¶
NumberStringRepair 返回一个介于min和max之间的string类型的随机数
- 通过Int64生成一个随机数,当结果的字符串长度小于max的字符串长度的情况下,使用0在开头补齐。
func ProbabilityChooseOne ¶ added in v0.0.24
ProbabilityChooseOne 输入一组概率,返回命中的索引
func RefreshSeed ¶
func RefreshSeed(seed ...int64)
func WeightMap ¶
func WeightMap[K comparable, T any](getWeightHandle func(data T) int, data map[K]T) T
WeightMap 按权重随机从map中产生一个数据并返回
func WeightSlice ¶
WeightSlice 按权重随机从切片中产生一个数据并返回
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.