I would like an efficient utility to generate unique sequences of bytes. UUID is a good candidate but UUID.randomUUID().toString()
generates stuff like 44e128a5-ac7a-4c9a-be4c-224b6bf81b20
which is good as long as you don't need to transmit it over HTTP, in which case the dashes need to be removed.
I'm looking for an efficient way to generate a random strings, only from alphanumeric characters (no dashes or any other special symbols).
I used JUG (Java UUID Generator) to generate unique ID. It is unique across JVMs. Pretty good to use. Here is the code for your reference:
You could download the library from: https://github.com/cowtowncoder/java-uuid-generator
I have just copied UUID toString() method and just updated it to remove "-" from it. It will be much more faster and straight forward than any other solution
Usage:
generateUUIDString(UUID.randomUUID())
Another implementation using reflection