# crypto/rand-hex Generate cryptographically secure random bytes from the OS CSPRNG. Returns the bytes as a lowercase hex string. ## Syntax
[crypto/rand-hex $n]
## Parameters - `$n` — Number of bytes to generate (1-4096); output is `2 * n` hex chars ## Examples
[crypto/rand-hex 16]    # 32-char hex string
[crypto/rand-hex 32]    # 64-char hex string (e.g. for session ids)
## Returns Lowercase hex string of length `2 * n`, or `%Err{ message "..." }` if `$n` is out of range. ## See Also `crypto/rand`, `crypto/hex-encode`, `crypto/sha256`