What is UUID v4?
Version 4 UUIDs are generated using random numbers. Unlike other versions that use timestamps or MAC addresses, v4 relies solely on randomness (specifically, 122 bits of it) to ensure uniqueness.
Key Features
- Randomness: Extremely low probability of collision (virtually zero).
- Privacy: Contains no personal information (like MAC addresses) or timestamps.
- Simplicity: Easy to generate without needing complex state or coordination.
When to use UUID v4?
Version 4 is the default choice for most applications. If you just need a unique ID and don't care about sorting or the time of creation, use v4. It's widely supported and safe for almost all use cases.