Documentation ¶
Overview ¶
Package randutil initialises properly random value generation and exposes a streamlined set of functions for it, including for crypto random tokens.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( Intn = rand.Intn Int63n = rand.Int63n )
Re-exported from math/rand for streamlining.
Functions ¶
func CryptoToken ¶
CryptoToken returns a crypthographically secure token string encoding nbytes random bytes. The result is URL-safe.
func CryptoTokenBytes ¶
CryptoTokenBytes returns a crypthographically secure token of nbytes random bytes.
func RandomDuration ¶
RandomDuration returns a random duration up to the given length.
func RandomKernelUUID ¶
func RandomKernelUUID() string
RandomKernelUUID will return a UUID from the kernel's procfs API at /proc/sys/kernel/random/uuid. Only to be used in very specific uses, most random code should use CryptoToken(Bytes) instead.
func RandomString ¶
RandomString returns a random string of length length.
The vowels are omitted to avoid that words are created by pure chance. Numbers are included.
Not cryptographically secure.
Types ¶
This section is empty.