xrand

package
v2.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LetterSeed           = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" // 字母字
	LetterLowerSeed      = "abcdefghijklmnopqrstuvwxyz"                           // 小写字母
	LetterUpperSeed      = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"                           // 大写字母
	DigitSeed            = "0123456789"                                           // 数字
	DigitWithoutZeroSeed = "123456789"                                            // 无0数字
	SymbolSeed           = "!\\\"#$%&'()*+,-./:;<=>?@[\\\\]^_`{|}~"               // 特殊字符
)

Variables

This section is empty.

Functions

func Digits

func Digits(length int, hasLeadingZero ...bool) string

Digits 生成指定长度的数字字符串

func Duration

func Duration(min, max time.Duration) time.Duration

Duration 生成[min,max]范围间的时间间隔

func Float32

func Float32(min, max float32) float32

Float32 生成[min,max)范围间的32位浮点数

func Float64

func Float64(min, max float64) float64

Float64 生成[min,max)范围间的64位浮点数

func Int

func Int(min, max int) int

Int 生成[min,max]的整数

func Int32

func Int32(min, max int32) int32

Int32 生成[min,max]范围间的32位整数,

func Int64

func Int64(min, max int64) int64

Int64 生成[min,max]范围间的64位整数

func Letters

func Letters(length int) string

Letters 生成指定长度的字母字符串

func Lucky

func Lucky(probability float64, base ...float64) bool

Lucky 根据概率抽取幸运值

func Rand

func Rand() *rand.Rand

Rand 获取全局随机对象

func Shuffle

func Shuffle(list []any)

Shuffle 打乱数组

func Str

func Str(seed string, length int) (str string)

Str 生成指定长度的字符串

func Symbols

func Symbols(length int) string

Symbols 生成指定长度的特殊字符串

func Weight

func Weight(fn func(v any) float64, list ...any) int

Weight 权重随机

Types

This section is empty.

Jump to

Keyboard shortcuts

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