package rands
import "tailscale.com/util/rands"
Package rands contains utility functions for randomness.
Index ¶
- func HexString(n int) string
- func IntN(seed uint64, n int) int
- func Perm(seed uint64, n int) []int
- func Shuffle[T any](seed uint64, data []T)
Functions ¶
func HexString ¶
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 ¶
IntN is like rand.IntN, but it is seeded on the stack and does not allocate or lock any RNG state.
func Perm ¶
Perm is like rand.Perm, but it is seeded on the stack and does not allocate or lock any RNG state.
func Shuffle ¶
Shuffle is like rand.Shuffle, but it does not allocate or lock any RNG state.
Source Files ¶
cheap.go rands.go
- Version
- v1.84.0 (latest)
- Published
- May 21, 2025
- Platform
- linux/amd64
- Imports
- 4 packages
- Last checked
- 2 days ago –
Tools for package owners.