Crypto
randomBytes

🔢 Generates an array of cryptographically secure random bytes.

Syntax

import { randomBytes } from '@opentf/std';
 
randomBytes(size: number = 32): Uint8Array;

Parameters

  • size: The number of bytes to generate. Default: 32.

Returns

A Uint8Array containing the random bytes.

Examples

randomBytes(16) //=> Uint8Array(16) [ ... ]

Related

Try