Here at Pixium Digital we often need to create sets of random usernames or team names.
This is either due to bench-marking with a need to simulate individuals groups or users.
Or for a need to anonymize leader-boards in various applications. This can be due to the fact that some applications have big firms as client that they want to keep anonymous hence we generate a random team or group name that can be displayed publicly without risking information leakage.
For this we have decided to build a small library that we can re-use to help us generate this content easily.
Basics
We first started to create a list of various information we would need. This includes adjectives, nouns, gamertags, colors, extended colors.
We then wanted to create the possibility to add an ID at the end of the random generated content (discord like) so we could have a result like this:
myC00lUsername#3948
thundering-memory#8682
For this we used a little trick of Math.random()
/**
* Generates a random ID (discord style)
* @returns string
*/exportconstrandomId=()=>{returnMath.random().toString().substring(2,6)}
Formats
Most of the random lists will be in the following format string[] however there will be specifications. For example teams will be composed in this format: