random

package
v1.55.5 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2024 License: AGPL-3.0, AGPL-3.0-or-later Imports: 4 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultGenerator = rand.New(rand.NewSource(time.Now().UnixNano()))

DefaultGenerator is the default generator for calls to Rand()

Functions

func Decimal

func Decimal() decimal.Decimal

Decimal returns a random decimal in the range [0.0, 1.0)

func Float64 added in v1.15.0

func Float64() float64

Float64 returns, as a float64, a pseudo-random number in the half-open interval [0.0,1.0).

func IntN

func IntN(n int) int

IntN returns a random integer in the range [0, n)

func NewSeededGenerator

func NewSeededGenerator(seed int64) *rand.Rand

NewSeededGenerator creates a new seeded generator

func SetGenerator

func SetGenerator(rnd *rand.Rand)

SetGenerator sets the rand used by Rand()

func String added in v1.50.0

func String(n int, chars []rune) string

String returns a string of length n composed of random characters from chars.

Types

This section is empty.

Jump to

Keyboard shortcuts

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