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!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s