AcediaDocumentation

crypt.random

Generates random bytes as a raw string.

The returned string can contain NUL bytes and other non-text data. Uses the operating system random generator.

crypt.random(length: number?): string

Parameters

ParameterTypeDescription
lengthnumber?Raw byte count; defaults to 16. Valid range is 1–65,536.

Errors: Zero, negative or greater-than-65,536 byte counts raise an error.

On this page