random

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2026 License: MIT Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init()

Init must be called at the start of every program.

If BOOTCS_RANDOM_SEED is set, it will be used to generate predictable random numbers.

func RandomElementFromArray

func RandomElementFromArray[T any](arr []T) T

func RandomElementsFromArray

func RandomElementsFromArray[T any](arr []T, count int) []T

func RandomFloat64

func RandomFloat64(min, max float64) float64

RandomFloat64 returns a random float64 number between [min, max)

func RandomFloat64s

func RandomFloat64s(min, max float64, count int) []float64

RandomFloat64s returns an array of `count` random Float64 values between [min, max).

func RandomInt

func RandomInt(min, max int) int

RandomInt returns a random integer between [min, max).

func RandomInts

func RandomInts(min, max int, count int) []int

RandomInts returns an array of `count` unique random integers between [min, max). It panics if count is greater than the range of possible values.

func RandomString

func RandomString() string

RandomString returns a random string of 6 words.

func RandomStrings

func RandomStrings(n int) []string

RandomStrings returns a random list of n strings.

func RandomWord

func RandomWord() string

RandomWord returns a random word from the list of words.

func RandomWords

func RandomWords(n int) []string

RandomWords returns a random list of n words.

func ShuffleArray

func ShuffleArray[T any](arr []T) []T

Types

This section is empty.

Jump to

Keyboard shortcuts

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