- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
change uuid to use Random.RandomDevice() instead of Random.default_rng() #35872
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
Merged
+33
−4
Merged
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
6dcace2
change uuid Random.default_rng() => Random.RandomDevice()
ssikdar1 63607eb
add regression test
ssikdar1 13cbf79
add NEWS entry
ssikdar1 3a637b3
update function docstrings
ssikdar1 34f29e3
add git add -u! compat message
ssikdar1 726b4f4
fix location of compat
ssikdar1 507b454
use a default RNG from RandomDevice initialized at startup
ssikdar1 ba4c68a
Revert "use a default RNG from RandomDevice initialized at startup"
ssikdar1 eb5ddc5
update signature and docstring
ssikdar1 1e91639
Update stdlib/UUIDs/src/UUIDs.jl
ssikdar1 c70c44a
Update stdlib/UUIDs/src/UUIDs.jl
ssikdar1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you make this change? Creating a new
RandomDevice()
is extremely cheap on non-Windows, and on Windows having a globaluuid_rng
is not thread-safe...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rfourquet I guess misunderstood @JeffBezanson 's comment above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My interpretation of it was using an RNG like
default_rng()
(currentlyMersenneTwister()
which is thread-safely initialized), which is therefore immune against the unqualifiedRandom.seed!()
but way faster thanRandomDevice()
, but "initialized fromRandomDevice()
" means it's seeded fromRandomDevice()
at startup.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But Stefan's last comment suggests to keep it how it was, because the poor performance of
RandomDevice
might considered as a non-problem until someone complains.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay! I reverted 507b454 . I'll leave it alone for now until there's something I should explicitly add/change/remove.