rands

package
v1.106.2 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2026 License: BSD-3-Clause Imports: 4 Imported by: 6 modules, 8 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

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