rands

package
v1.79.0-pre Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: BSD-3-Clause Imports: 4 Imported by: 5

Documentation

Overview

Package rands contains utility functions for randomness.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HexString

func HexString(n int) string

HexString returns a string of n cryptographically random lowercase hex characters.

That is, HexString(3) returns something like "0fc", containing 12 bits of randomness.

func IntN added in v1.68.0

func IntN(seed uint64, n int) int

IntN is like rand.IntN, but it is seeded on the stack and does not allocate or lock any RNG state.

func Perm added in v1.60.0

func Perm(seed uint64, n int) []int

Perm is like rand.Perm, but it is seeded on the stack and does not allocate or lock any RNG state.

func Shuffle added in v1.60.0

func Shuffle[T any](seed uint64, data []T)

Shuffle is like rand.Shuffle, but it does not allocate or lock any RNG state.

Types

This section is empty.

Jump to

Keyboard shortcuts

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