random

package
v0.0.32 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProbabilityTrue added in v0.0.20

func ProbabilityTrue(percentage int) bool

ProbabilityTrue 在指定的百分比范围内返回true

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 生成指定长度的随机字符串

Types

type SeedRandom added in v0.0.21

type SeedRandom struct {
	// contains filtered or unexported fields
}

func NewRandom added in v0.0.15

func NewRandom(seed int64) *SeedRandom

NewRandom 创建随机数生成器 指定随机算法的种子

func (*SeedRandom) RandInt added in v0.0.21

func (s *SeedRandom) RandInt(max int) int

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

func (*SeedRandom) RandRangeInt added in v0.0.21

func (s *SeedRandom) RandRangeInt(min, max int) int

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

Jump to

Keyboard shortcuts

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