package
1.3.48
Repository: https://github.com/sandwich-go/boost.git
Documentation: pkg.go.dev

# README

xrand

随机辅助函数

  • 生成随机数
  • 生成随机字符串

例子

fmt.Println(String(10))

Output:

zaaaadtxjr

# Functions

IsSelected100n number / 100 的概率返回true.
RandomInt 随机某个值,该值[min, max].
RandomSelectOneFromArray array(20,30,50) 返回0的概率0.2 返回1的概率0.3 返回2的概率0.5.
RandomSelectOneFromMap map[int32]int32{1:10,2:24,3:53}.
String 随机 n 个字符的字符串.
StringWithTimestamp 随机 n 个字符的字符串,并以当前时间戳做后缀.

# Variables

FastRand is a fast thread local random function.
FastRandUint32n returns pseudorandom uint32 in the range [0..maxN).