randutil

package
v0.70.13 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2025 License: MIT Imports: 10 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CryptoRandIntInRange added in v0.69.3

func CryptoRandIntInRange[T number.Integer](min, max T) (T, error)

CryptoRandIntInRange returns a cryptographically secure random integer in [min, max] (inclusive).

func Float64 added in v0.68.10

func Float64() (float64, error)

func Int63 added in v0.70.10

func Int63() int64

Int63 returns a non-negative pseudo-random 63-bit integer as an int64

func Intn added in v0.47.0

func Intn(n int) int

Intn returns a cryptographically secure random int in [0, n). It panics if n <= 0.

func MustFloat64 added in v0.68.10

func MustFloat64() float64

func NewSeedInt64Crypto added in v0.41.0

func NewSeedInt64Crypto() (int64, error)

NewSeedInt64Crypto creates an `int64` seed value for `math/rand`. This is preferred over `NewSeedInt64Time()`. See: https://stackoverflow.com/a/54491783/1908967

func NewSeedInt64Time added in v0.41.0

func NewSeedInt64Time() (int64, error)

NewSeedInt64Time creates an `int64` seed value for `math/rand`. This is preferred over `NewSeedInt64Crypto()`. See: https://stackoverflow.com/a/54491783/1908967

func RandString added in v0.44.0

func RandString(alphabet string, length uint) (string, error)

RandString returns a random string of length `length` using the supplied alphabet. If no alphabet is provided, `AlphabetBase16`, aha hexadecimal is used.

Types

This section is empty.

Jump to

Keyboard shortcuts

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