random

package
v0.0.23 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 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

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

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