Reading document, I saw there are four types of uuid. I am wondering how to generate type 1(timestamp based) and type2 (DCE security based) uuid. Any idea?
Asked
Active
Viewed 5,464 times
1
-
2possible duplicate of https://stackoverflow.com/questions/18244897/how-to-generate-time-based-uuids?rq=1 – Jiri Kremser Mar 16 '15 at 02:51
-
Possible duplicate of [How to generate time based UUIDs?](http://stackoverflow.com/questions/18244897/how-to-generate-time-based-uuids) – dogfish May 05 '17 at 23:34
1 Answers
1
You can also implement your own if for whatever reason you don't want to use JUG (as suggested above).
For this check the class UUID. You need to use System.nanoTime() and ensure successive calls return increasing values (so if you get two times the same time value, then return the greatest returned value so far plus 1).
The layout of the UUID type 1 can be found in: http://www.ietf.org/rfc/rfc4122.txt

Daniel
- 21,933
- 14
- 72
- 101