github.com/redis/go-redis/v9/internal/rand
No package summary is available.
Package
Files: 1. Third party imports: 0. Imports from organisation: 0. Tests: 0. Benchmarks: 0.
Vars
var pseudo = rand.New(&source{src: rand.NewSource(1)})
Types
source
This type doesn't have documentation.
type source struct {
src rand.Source
mu sync.Mutex
}
Functions
func Int
Int returns a non-negative pseudo-random int.
func Int() int { return pseudo.Int() }
Cognitive complexity: 0
, Cyclomatic complexity: 1
func Int63n
Int63n returns, as an int64, a non-negative pseudo-random number in [0,n). It panics if n <= 0.
func Int63n(n int64) int64 { return pseudo.Int63n(n) }
Cognitive complexity: 0
, Cyclomatic complexity: 1
func Intn
Intn returns, as an int, a non-negative pseudo-random number in [0,n). It panics if n <= 0.
func Intn(n int) int { return pseudo.Intn(n) }
Cognitive complexity: 0
, Cyclomatic complexity: 1
func Perm
Perm returns, as a slice of n ints, a pseudo-random permutation of the integers [0,n).
func Perm(n int) []int { return pseudo.Perm(n) }
Cognitive complexity: 0
, Cyclomatic complexity: 1
func Seed
Seed uses the provided seed value to initialize the default Source to a deterministic state. If Seed is not called, the generator behaves as if seeded by Seed(1).
func Seed(n int64) { pseudo.Seed(n) }
Cognitive complexity: 0
, Cyclomatic complexity: 1
func Shuffle
Shuffle pseudo-randomizes the order of elements. n is the number of elements. swap swaps the elements with indexes i and j.
func Shuffle(n int, swap func(i, j int)) { pseudo.Shuffle(n, swap) }
Cognitive complexity: 0
, Cyclomatic complexity: 1
func (*source) Int63
func (s *source) Int63() int64 {
s.mu.Lock()
n := s.src.Int63()
s.mu.Unlock()
return n
}
Cognitive complexity: 0
, Cyclomatic complexity: 1