Documentation
¶
Overview ¶
Package random provides cryptographically secure random helpers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidLength = errors.New("random: length must be non-negative")
ErrInvalidLength is returned when a requested length is negative.
Functions ¶
func MustToken ¶
MustToken returns n random hex characters and panics if the CSPRNG fails or n is negative. Intended for request IDs where failure is unrecoverable.
func Shuffle ¶
func Shuffle[T any](sli []T)
Shuffle permutes sli in place using the auto-seeded math/rand/v2 generator. It is NOT cryptographically secure; do not use it for secrets.
func UUIDWithLen ¶
UUIDWithLen returns exactly n lowercase hex characters from the CSPRNG.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.