Thursday, July 3, 2014

How to generate random UUID in Java

Hi there! Generating a random UUID is much more easier than you could ever imagine! I use the following block of code, whenever I'm in a need of more than ten:
for(int i = 0; i < 30; i++) {
   System.out.println(UUID.randomUUID());
}
If things get difficult and time passes, working with UUIDs, you 'll probably get lost, if the way you chose to generate your UUID was "a bunch at a time", like above, so you could either visit a site, like this or modify your program like below:
   System.out.println(UUID.randomUUID());
Cheers!

No comments:

Post a Comment