[Yanel-dev] Unique IDs
Balz Schreier
balz.schreier at gmail.com
Wed Jan 12 09:38:15 CET 2011
Dear all,
Sometimes we need unique IDs, for identifying a session, a cookie or other
things.
Usually we use the UUID class that comes with Java SE:
UUID.randomUUID().toString() --> 67849f28-c0af-46c7-8421-94f0642e5d4d (128
Bits)
But that is very long and maybe not suitable if you require people to enter
that ID in a form on your web site:
Do you have experience with other number generators?
I see that UUID has also other methods, e.g.:
UUID.randomUUID().getLeastSignificantBits() --> 6174657925133947722 (64
Bits)
UUID.randomUUID().getMostSignificantBits() --> 5706839542716611039 (64
Bits)
I was recently pointed to this URL where you can generated IDs by
configuring the length and the used characters (digits only etc.):
http://www.thegeeks.us/index.php/Random_Password_Generator_Writen_In_Java
I also posted on stackoverflow.com this question:
http://stackoverflow.com/questions/4666647/how-to-create-user-friendly-uniq=
ue-ids-uuids-or-other-unique-identifiers-in-java
Cheers
Balz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wyona.org/pipermail/yanel-development/attachments/2011011=
2/cca872b0/attachment.html
More information about the Yanel-development
mailing list