rand

package
v1.15.4 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 2 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SafeRand

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

SafeRand is a concurrency-safe source of pseudo-random numbers. The Go stdlib's math/rand.Source is not concurrency-safe. The global source in math/rand would be concurrency safe (due to its internal use of lockedSource), but it is prone to inter-package interference with the PRNG state. Also see https://github.com/cilium/cilium/issues/10988

func NewSafeRand

func NewSafeRand(seed int64) *SafeRand

func (*SafeRand) Float64

func (sr *SafeRand) Float64() float64

func (*SafeRand) Int63

func (sr *SafeRand) Int63() int64

func (*SafeRand) Int63n

func (sr *SafeRand) Int63n(n int64) int64

func (*SafeRand) Intn

func (sr *SafeRand) Intn(n int) int

func (*SafeRand) Perm

func (sr *SafeRand) Perm(n int) []int

func (*SafeRand) Seed

func (sr *SafeRand) Seed(seed int64)

func (*SafeRand) Shuffle

func (sr *SafeRand) Shuffle(n int, swap func(i, j int))

func (*SafeRand) Uint32

func (sr *SafeRand) Uint32() uint32

func (*SafeRand) Uint64

func (sr *SafeRand) Uint64() uint64

Jump to

Keyboard shortcuts

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