🔢 Generates a cryptographically secure random integer between min (inclusive) and max (inclusive).
Uses the standard Web Crypto API (globalThis.crypto).
Syntax
TypeScript
import { randomInt } from '@opentf/std'; randomInt(min: number, max: number): number;
Parameters
min: The minimum value (inclusive).max: The maximum value (inclusive).
Both bounds must be integers.
Returns
A random integer.
Examples
TypeScript
randomInt(0, 100) //=> 42 randomInt(1, 10) //=> 7