You can’t remember other people’s last names, so you have to force yourself to give other people random names. There may be some degree of obsessive-compulsive disorder associated with this behavior.
You can try to see a psychologist and change yourself through psychotherapy.
Or try to correct yourself.
First of all, you can think about it, if someone gives you a random name, or someone doesn't call you by your name, or the other person admits that they forgot your name, which one would you care more about? Does naming you randomly make you more unhappy or disappointed?
Use empathy to make yourself aware of the consequences, and maybe you can force yourself not to use random names next time.
In addition, you must also be appropriately tolerant of yourself. Because I meet so many people, I may not be able to remember everyone’s name. In fact, it is normal to be unable to remember. Why do you have to call the other person by name?