Skip to content

Proposal to generate UUIDs using RandomNumberGenerators #1271

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

FranzBusch
Copy link
Member

This PR adds a proposal to generate UUID's using RandomNumberGenerators

@FranzBusch FranzBusch force-pushed the fb-random-uuid branch 2 times, most recently from fb5c82f to df12e88 Compare April 24, 2025 18:59
Copy link
Contributor

@itingliu itingliu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you need two proposal files

This PR adds a proposal to generate `UUID's` using `RandomNumberGenerator`s
var secondBits = second

// Set the version to 4 (0100 in binary)
firstBits &= 0xFFFFFFFFFFFF0FFF // Clear the last 12 bits
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the code wrong or the comment wrong? This appears to clear bits 12 ... 15.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment was wrong. This clears bits 48-51 of the UInt64 aligned with the RFC. Example below

10010100 10010010 10111010 11000100 11110011 01010011 00101001 11100111
10010100 10010010 10111010 11000100 11110011 01010011 00001001 11100111

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants