There is a requirement in which I need to generate alphanumeric strings of length 8. There are lot questions on Stack Overflow, but I was not able to find one specific to my requirement.
I need to generate barcodes on which I need to show this string. I can generate as suggested in this Stack Overlow question, but what if
My application is running multiple instances? There may be a case of having duplicate generated string.
What happens when application restarts? As it is not maintaining states or last generated values.
I could use a database like MySQL with unique key constraints to mitigate these issues, but still I think (correct me please) it is not the standard way to implement this solution, because in this too I need to handle the exception of unique key constraints and try to generate again until I get a unique value.