rand

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2025 License: Apache-2.0 Imports: 2 Imported by: 9

Documentation

Overview

Package rand is used for concurrency safe random number generator. This package provides a thread-safe wrapper around math/rand for use in load balancing and server selection. It is NOT suitable for cryptographic purposes and should not be used for security-sensitive operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Rand

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

Rand is used for concurrency safe random number generator.

func New

func New(seed int64) *Rand

New returns a new Rand from seed.

func (*Rand) Int

func (r *Rand) Int() int

Int returns a non-negative pseudo-random int from the Source in Rand.r.

func (*Rand) Perm

func (r *Rand) Perm(n int) []int

Perm returns, as a slice of n ints, a pseudo-random permutation of the integers in the half-open interval [0,n) from the Source in Rand.r.

Jump to

Keyboard shortcuts

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