random

package
v0.0.41 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2025 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProbabilityResult added in v0.0.40

func ProbabilityResult(percentage map[any]float64) (any, error)

ProbabilityResult 按照设置的各种key(概率结果)执行随机返回对应的key(发生的结果) 所有key的概率之和必须为100%

func ProbabilityTrue added in v0.0.20

func ProbabilityTrue(percentage float64) bool

ProbabilityTrue 随机执行指定概率(0-100%)返回true的计算 0 <= percentage <= 100 超出范围将永远返回 false。

func RandInt

func RandInt(max int) int

RandInt 生成指定范围内随机数 [0,max]

func RandRangeInt

func RandRangeInt(min, max int) int

RandRangeInt 生成指定范围内随机数 [min,max]

func RandString

func RandString(length int) string

RandString 生成指定长度的随机字符串

func UUID added in v0.0.36

func UUID() string

UUID 生成UUID

Types

This section is empty.

Jump to

Keyboard shortcuts

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