Standard library
CSPRNG
Cryptographic random bytes and u64.
Introduction
Cryptographic random bytes and u64. Import std/crypto/random to bind the module as random. Call free functions as random.name(...). Struct methods use a receiver value.
/ std/crypto/random
This page is the package reference for std/crypto/random. Private helpers used only by co-located tests are not listed.
Functions
Free functions on random. Each function has a short description, an example, then parameters and return shape.
fill
Fills n cryptographically secure random bytes. Call form: random.fill(n).
/ std/crypto/random
$ b = random.fill(16)
Parameters: n: number of bytes. Returns: n random bytes.
u64
Returns a cryptographically secure random u64. Call form: random.u64().
/ std/crypto/random
$ n = random.u64()
Parameters: No parameters. Returns: Integer random value.