Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1085235
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:39:51+00:00 2026-05-16T22:39:51+00:00

I have a simple C++ function that calls uuid_generate_random. It seems the generated UUID

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T22:39:51+00:00Added an answer on May 16, 2026 at 10:39 pm

    You’re quite correct that libuuid seems not to be adhering to the ITU recommendation… It could be argued that the recommendation itself is overly pedantic about retaining version information, as it serves little purpose beyond allowing technorati to easily distinguish how the UUID was generated, but that’s beside the point.

    The good news is that, if you care to, you can easily make these into conformant UUIDs through the simple expedient of smashing in the right version bits. 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple recursive function RCompare() that calls a more complex function Compare()
I have a simple function that calls other functions: function update() { updateMissiles(); updatePlayer;
I have written a simple script that calls a function in a while loop.
I have a simple script which calls a function that is set in the
I have a fairly simple python loop that calls a few functions, and writes
I have a simple function that looks at an incoming mySQL data type and
I have a simple function that works in chrome, but in Internet explorer (9)
I have a simple function that returns an NSString after decoding it. I use
I have a simple function that shows loading spinner while fetching data (usually takes
I have a simple function that I'd like to test (perhaps mostly to appease

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.