Crypto
uuidv4

🆔 Generates a random UUID v4 using native crypto.

In Node.js 18, you need to polyfill `globalThis.crypto` to use this function.

Syntax

import { uuidv4 } from '@opentf/std';
 
uuidv4(): string;

Returns

A random UUID v4 string.

Examples

uuidv4() //=> 'f47ac10b-58cc-4372-a567-0e02b2c3d479'

Related

Try