UUIDs are usually quite nice to use as random IDs. Most people including me would simply use a UUID v4 as a way to generate random IDs. But UUIDs v4 is just plain randomness. There is no way to tell if a
- 128-bit compatibility with UUID
- 1.21e+24 unique ULIDs per millisecond
- Lexicographically sortable!
- Canonically encoded as a 26 character string, as opposed to the 36 character UUID
- Uses Crockford’s base32 for better efficiency and readability (5 bits per character)
- Case insensitive
- No special characters (URL safe)
- Monotonic sort order (correctly detects and handles the same millisecond)
Here’s how it looks:
ulid() // 01ARZ3NDEKTSV4RRFFQ69G5FAV
And there’s a wide selection of libraries implementing ULID for all major programming languages.