Generates v4 UUID.
Uses crypto.randomUUID() when available (modern Node, browsers, workers) for cryptographically strong randomness. Falls back to a Math.random()-based implementation in environments without it.
crypto.randomUUID()
Math.random()
generateUUID()// '8e07ef4a-0d1f-45c2-b06b-9495e869b299' Copy
generateUUID()// '8e07ef4a-0d1f-45c2-b06b-9495e869b299'
Generates v4 UUID.
Uses
crypto.randomUUID()when available (modern Node, browsers, workers) for cryptographically strong randomness. Falls back to aMath.random()-based implementation in environments without it.