Generating various versions of Boost UUID (Universally Unique ID)

Viewed 997

I was reading up about Boost UUID. I understand that there are various ways of generating UUIDs, this is determined by the version field of the UUID. This document shows 5 different versions of UUID. The Boost UUID API let you query a UUID for it's version. But how does one set the version? The Boost documentation page shows only one way of creating a UUID, as follows -

boost::uuids::uuid u = boost::uuids::random_generator()();

So, can you please show me how to generate UUIDs based on the other 4 versions? Especially version 1, i.e. time-based generator seems very interesting to me.

Also, can you please tell me how is a UUID version different from it's variant? They both sound like the same thing.

1 Answers
Related