uuid.version4

STRINGuuid.version4

Available inall subroutines.

A version 4 UUID is a randomly generated 128-bit identifier. As in other UUIDs, 4 bits are used to indicate version 4, and 2 bits are used to indicate the variant. Thus, 6 bits are constant, leaving 122 bits for the randomly generated part, for a total of 2122 (5.3×1036, 5.3 undecillion) possible values.

Example

set req.http.X-Unique-Id = uuid.version4();

Try it out

uuid.version4 is used in the following code examples. Examples apply VCL to real-world use cases and can be deployed as they are, or adapted for your own service. See the full list of code examples for more inspiration.

Click RUN on a sample below to provision a Fastly service, execute the code on Fastly, and see how the function behaves.

Use A/B testing to personalize responses

Serve different responses to separate user cohorts.