Generating a unique identifier for database records or session tokens requires cryptographic security. Standard pseudorandom number generators can be predicted.

UUID Version 4

UUIDv4 utilizes cryptographically secure random number generators (CSPRNG) to guarantee uniqueness. The chance of a collision is so infinitesimally small that you would need to generate 1 billion UUIDs per second for 85 years to hit a 50% chance of a single duplicate.