Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

UUID generation

 
Joe Harry
Ranch Hand
Posts: 10122
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys,

Did anyone perform any UUID generation before. Can you please share some knowledge on it. I googled for UUID and I was not able to get sufficient information on it.
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Javadoc has some information on how a UUID can be created in Java plus a link to some more general information.
 
Joe Harry
Ranch Hand
Posts: 10122
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had a look at javadoc and also had a look at the wikipedia. What I want to know is that would it be good to write a UUID generator algorythm or to just use a Random UUID generator? Any suggestions guys?
 
Joe Harry
Ranch Hand
Posts: 10122
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is what the wikipedia has got to say for random UUID generations,

http://en.wikipedia.org/wiki/UUID#Version_4_.28random.29

Is it worthy to just use a random UUID generation or write a custom one? Please advice!
 
Joe Harry
Ranch Hand
Posts: 10122
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The link below also says that only version 3 and version 4 generation methods are supported in java. So will using a random UUID generator suffice?

http://en.wikipedia.org/wiki/UUID#Java
 
Charles Lyons
Author
Ranch Hand
Posts: 836
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So will using a random UUID generator suffice?
How can we possibly say, without knowing what it is that it needs to do?! Will it suffice for what exactly??
 
Joe Harry
Ranch Hand
Posts: 10122
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I simply want to ensure uniqueness for some data.
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, the links you gave show a number of ways of generating UUIDs in Java. Do they meet your needs ? If so, problem solved. If not, then you need to tell us why they don't meet your needs and then maybe we can suggest something else.
 
Tanu Gulati
Ranch Hand
Posts: 113
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
while generating Guid follow some common process.
1.) it should be a Big String at least 32 bytes
2.) while generating Guid you should not depend on just one resource. you should generate Guid by combing string from atleast 3-4 resources.

For ex. first 12 characters from one resource then some 8 from another one and so on. otherwise there are big changes of mixing up.

for ex. first 11 character you can generate from "System" class using 11 characters from out put of System.getmillSeconds()
then rest 8 you can generate using random number generator and so on.

and one more thing if it a combination of Integer and character it is considered as good one.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic