random

package
v0.0.0-...-037b315 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Array

func Array[T any](arr []T) []T

Array 随机打乱arr的元素

func Bytes

func Bytes(size int) []byte

func IsRanded

func IsRanded(weight int32, opts ...Option) bool

IsRanded 给定权重,判断是否能随机到,默认是万分比随机

func NewLockedSource

func NewLockedSource(seed int64) rand.Source

func RandomElement

func RandomElement[T any](arr []T) T

func RandomInRange

func RandomInRange(min, max int64) int64

func RandomSubset

func RandomSubset[T int | int32 | int64](min, max T, n int) []T

func String

func String(size int) string

Types

type Option

type Option func(o *option)

func WithRandVal

func WithRandVal(val int32) Option

Jump to

Keyboard shortcuts

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