How to generate a random String in Java - Stack Overflow
The first question you need to ask is whether you really need the ID to be random. Sometime, sequential IDs are good enough. Now, if you do need it to be random, we first note a generated sequence of numbers that contain no duplicates can not be called random. :p Now that we get that out of the way, the fastest way to do this is to have a Hashtable or HashMap containing all the IDs already ...