Are UUIDs generated in hexadecimal order?

74 views
Skip to first unread message

Matthijs Burke

unread,
Sep 25, 2014, 2:26:16 PM9/25/14
to java-uuid-ge...@googlegroups.com
Hi there,

I have a question. I use the Java UUID generator to generate IDs for executions and store the UUIDs to my DB. I am not entirely sure how the generator behaves and therefore I want to ask if the generated UUIDs are always generated in hexadecimal order, or can there be discrepancies? What is the exact behavior? Can anyone help me with this?

Thanks and best regards,

Mat

Tatu Saloranta

unread,
Sep 25, 2014, 2:31:08 PM9/25/14
to java-uuid-ge...@googlegroups.com
A reasonable explanation of UUID generation can be found from Wikipedia:

http://en.wikipedia.org/wiki/Universally_unique_identifier

and it explains the methods JUG uses. Resulting UUIDs are not unfortunately in hexadecimal order; although bit of slicing and dicing of UUIDs generaed using Time+Location - based variants can be used to provide monotonically increasing (~= alphabetic) ordering. UUID specification indicates order of fields in hex-representation in case you want to do such shuffling. I am planning to do something similar for one of my projects, to get creation-time index.

Random-/Hash-based variants will not produce anything ordered in any way.

Hope this helps,

-+ Tatu +-


--
You received this message because you are subscribed to the Google Groups "Java Uuid Generator Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to java-uuid-generato...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages