I have a users table and I need to create a unique, random looking alphanumeric "id" for each user (they already have autoincrementing ids as usually). This identifier must:
- Be unique
- Be random looking
- Match the pattern
AAAA-1234(4 letters, 4 numbers)
Is there a better way than to keep randomly generating strings until I find one that is not in the database yet?
Aucun commentaire:
Enregistrer un commentaire