In my application, we need to assign unique identifiers to users, but this is turning out to be trickier than I would have thought.
We load all users from a bulk feed, and do all the assigning programmatically. Users can't pick their own.
We also want all user names to be the same length, for certain display purposes.
Also, the users are students in a school district, and they are children, some of them quite young, so the names have to be short and reasonably memorable. So just generating a 7 digit code isn't very user friendly.
We know the name of each child, but there are laws about identifying children. We wouldn't want, for instance, someone to be able to post a screenshot of their username online and have someone be able to identify their real name.
My first idea for this was to choose, say, the first 3 characters of the first name, the first 2 characters of the last name, and then append a sequence number to avoid collisions. So mine would be something like
This failed, though, because some kids have names with fewer than 3 letters. But the more damning problem was that a small number of these combinations produced swear words, and that is so bad in software for children that we can't allow it to happen even once.
It turns out to be surprisingly hard to prevent this, because there are so many combinations of letters that don't spell anything, but if you tried to read them out loud, you'd get something obscene. Catching all of these, reliably, seems impossible, and even if I could, I'd still need to find some way to generate a name for that user.
So what to do?
For a modern system the answer is probably emoji.
In short, you are looking for a username that is:
As long as your system supports Unicode, you could assign a random set of 4 emojis to each user as a unique ID. Even if you limited it to only 80 animal symbols (to avoid trouble with #6), there should be over 40 million possible IDs. It should be fairly easy for even a young child to find 🦊🦋🐢🐔 on a list if they know what they are looking for or enter it into a login prompt.
If your system/database is limited to traditional ASCII characters (A-Z, 0-9), there may not be many option unless you can loosen some of the criteria.
A uniform length is probably the tightest restriction, as it will eventually exhaust the memorable strings, or even all the values if it's too short. If you can lift that restriction, you can assign a couple random dictionary words to each person. You might need to double check the word list to avoid running into #6, but that might also be a fool's errand. Children can read double meanings into everything and slang is constantly changing. A safe user ID today could become a derogatory term by the end of the semester.
Giving up on it being memorable would be the next easiest restriction to lift since you'd be able to use any random string you like. Obviously, this isn't the preferred option (and I already feel bad for any elementary schooler forced to memorize "ed5331aa90" to turn in their homework).
A possible workaround for using an emoji-based solution on older infrastructure could be to render the user ID as emoji to the users, but store it as the Unicode values behind the scenes. You could track user 1f98a1f98b1f4221f414 but the kid only has to remember 🦊🦋🐢🐔.