I'm planning to use ThreadLocalRandom.current().nextLong() to generate IDs across various threads. The application's criteria is to have 19 digits numeric value. We used System.nanoTime() before with padding but lately its been generating same IDs.
I tried using ThreadLocalRandom.current().nextLong() and it's generating 19 digits long value. Is the value for it always 19 digits or it can be less than 19 digits too? And is it safe to use between multiple threads?
Aucun commentaire:
Enregistrer un commentaire