Documentation ¶
Index ¶
- type SafeRand
- func (sr *SafeRand) Float64() float64
- func (sr *SafeRand) Int63() int64
- func (sr *SafeRand) Int63n(n int64) int64
- func (sr *SafeRand) Intn(n int) int
- func (sr *SafeRand) Perm(n int) []int
- func (sr *SafeRand) Seed(seed int64)
- func (sr *SafeRand) Shuffle(n int, swap func(i, j int))
- func (sr *SafeRand) Uint32() uint32
- func (sr *SafeRand) Uint64() uint64
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 ¶
Click to show internal directories.
Click to hide internal directories.