When the system generates a username, a lot depends on the length of the user's first name and last name.
If possible, the system will generate a username in the format:
[prefix][first name][last name]
If that can't fit in 20 characters it will replace the first name with the user's initial:
If that still can't fit, surnames are shortened. Examples where the prefix is ABC:
Anything to watch out for?
The three digit number is a fixed component, so there is a limit of 999 accounts that can generate the same combination of letters. You are only likely to hit this limit if if you have decided to create all users with the same name for any reason. If you are doing that for more than 998 accounts you will need to use an account creation method where you specify the username such as bulk upload or via the API. Don't forget that you must also be able to link an account back to the user by some means.
Usernames are limited to the ISO-8859-1 character set so cannot be generated if the user's first or last name has any other characters. Account creation would fail, so in those cases you would again need to manually specify usernames.