Skip to content
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

uuid() generates repeating values #4

Closed
yostx038 opened this issue Jun 5, 2018 · 1 comment · Fixed by #12
Closed

uuid() generates repeating values #4

yostx038 opened this issue Jun 5, 2018 · 1 comment · Fixed by #12

Comments

@yostx038
Copy link

yostx038 commented Jun 5, 2018

When generating UUIDs with use_time set to FALSE, identical values often appear in the output, even for very small values of n. Example:

uuid(n = 10, use_time=FALSE)
[1] "82543727-120e-438c-b656-23ef800ee96f" "a56363a5-120e-438c-b933-b581800ee96f" "27375482-120e-438c-b933-b581800ee96f"
[4] "00000000-120e-438c-b933-b581800ee96f" "82543727-120e-438c-b933-b581800ee96f" "a56363a5-120e-438c-b933-b581800ee96f"
[7] "27375482-120e-438c-b933-b581800ee96f" "00000000-120e-438c-b933-b581800ee96f" "82543727-120e-438c-b933-b581800ee96f"
[10] "a56363a5-120e-438c-b933-b581800ee96f"

@richfitz
Copy link
Member

richfitz commented Jun 25, 2018

Thanks for the report: the ids::uuid is a very thin wrapper around uuid::UUIDgenerate; the help there says

use.time: logical, if ‘TRUE’ then time-based UUID is generated, if
‘FALSE’ then a random UUID is generated, if ‘NA’ then random
one is generated if a sufficiently reliable source of random
numbers can be found, otehrwise a time-based UUID is
generated.

So your system must be triggering that situation (insufficiently reliable source of random numbers)? I can't replicate on Linux - are you perhaps on windows? On any case this is really not ideal! I suspect you're hitting this issue in the underlying uuid package.

You might find that the ids::random_id() behaves better - that uses openssl for the random data

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 a pull request may close this issue.

2 participants