FrandomUUID
Bun

function

crypto.randomUUID

function randomUUID(
): `${string}-${string}-${string}-${string}-${string}`;

Generates a random RFC 4122 version 4 UUID. The UUID is generated using a cryptographic pseudorandom number generator.

Referenced types

interface RandomUUIDOptions

  • disableEntropyCache?: boolean

    By default, to improve performance, Node.js will pre-emptively generate and persistently cache enough random data to generate up to 128 random UUIDs. To generate a UUID without using the cache, set disableEntropyCache to true.