Generate UUID R←120⌶Y

This function generates a UUID (Universally Unique IDentifier) according to the RFC 9562 specification. In this system, the string representation of each UUID comprises multiple groups of hexadecimal characters separated by single dashes/hyphens.

A UUID is a label that uniquely identifies objects in computer systems; it does not depend on a central registration authority or co-ordination between the parties generating them. UUIDs are also known as GUIDs (Globally Unique IDentifiers).

Y specifies the UUID version required. Supported values of Y are:

Y Version Generated Hexadecimal Values
0 Nil UUID All zero
4 UUIDv4 Random
7 UUIDv7 A combination of (Unix Epoch) time-based and random

The result R is a vector containing the generated 36-character UUID.

Example

      1204
32cd549f-eb33-4457-bf45-babf26dc2b53

      {120}¨
00000000-0000-0000-0000-000000000000