I have a simple C++ function that calls "uuid_generate_random". It seems the generated UUID is not standard compliant (UUID Version 4). Any Ideas?
The code I am using is (uuid_generate_random & uuid_unparse functions are available in libuuid):
char uuidBuff[36];
uuid_t uuidGenerated;
uuid_generate_random(uuidGenerated);
uuid_unparse(uuidGenerated, uuidBuff);
I understand that "uuid_generate_random" generates the UUID version 4, however, the string that is being returned is like:
Run1) 2e9dc3c5-426a-eea0-8186-f6b65b5dc361
Run2) 112c6a78-51bc-cbbb-ae9c-92a33e1fd95f
Run3) 5abd3d6d-0259-ce5c-8428-a51bacc04c0f
Run4) 66a22485-7e5f-e5c2-a317-c1b295bf124f
It appears that it is returning random characters for the whole string. The definition from wikipedia, it should be in the form of:
xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx with any hexadecimal digits for x but only one of 8, 9, A, or B for y.
Any input will be greatly appreciated.
Regards Daniel