Practical guide
How to use the uuid generator
The UUID generator creates a version 4 universally unique identifier from random data. UUIDs are convenient for distributed records and correlation IDs where central sequential numbering is undesirable.
Good reasons to use it
- Create an identifier for a new test record or fixture.
- Generate a correlation ID for logs and support examples.
- Use a non-sequential public identifier where the application permits it.
A reliable workflow
- Generate a version 4 UUID.
- Copy it exactly, including hyphens.
- Apply database uniqueness constraints when duplicates would be harmful.
How to interpret the result
Version 4 UUIDs have an extremely large address space, making accidental collision unlikely, but they are not a substitute for validation or a database constraint.
Frequently asked questions
Can two generated UUIDs ever match?
A collision is theoretically possible but extraordinarily unlikely with a correct random generator. Important systems should still enforce uniqueness.
Should UUIDs be used as passwords?
No. Identifiers have different security requirements from passwords and access tokens.