random

package
v0.0.0-...-0818f1f Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bet_init

func Bet_init(out *rpc.SlotGameStartRes)

func ChooseWeightItem

func ChooseWeightItem(candidates []int, luckyValue int32) int

ChooseWeightItem choose one index from giving array 'candidates'

func Drop

func Drop(d map[int32]int32) (key int32)

func GenerateRandomNumber

func GenerateRandomNumber(start int, end int, count int, seed int64) []int

生成count个[start,end)结束的不重复的随机数

func Hit

func Hit(probability int) bool

Hit returns if probability > a random number range [0,10000)

func IceRand

func IceRand(count int32, arr []*rpc.XY)

func Int31

func Int31() int32

Int31 method

func Int31n

func Int31n(limit interface{}) int32

Int31n method

func Intn

func Intn(limit int) int

Intn returns a random number in [0,limit)

func IsBonus

func IsBonus(arr []*rpc.XY) bool

func Perm

func Perm(limit int, seed int64) []int

Perm method: generate different order [0, limit) slice

func RangeFloat32

func RangeFloat32(min, max float32) float32

RangeFloat32 返回[min, max]之间的float32 放大factor倍后用Int63n随机

func RangeInt

func RangeInt(start int, end int, seed int64) int

在[start,end]之间随机生成一个数

func RangeIntWithout

func RangeIntWithout(start int, end int, seed int64, without int, i int32) int

在[start,end]之间随机生成一个不等于without的数

func Round32

func Round32(f float32, n int) float32

func Round64

func Round64(f float64, n int) float64

Round eg:Round(1.056,2) => 1.06, Round(1.054,2)=>1.054

func Sample

func Sample(m map[int32]int32) int32

sample one

func SampleN

func SampleN(m map[int32]int32, n int) []int32

sample n without replace

func SlotGameRand

func SlotGameRand(in *rpc.SlotGameStartRes) (err error, out *rpc.SlotGameStartRes)

Types

This section is empty.

Jump to

Keyboard shortcuts

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