Repository navigation
Replaced std::random_shuffle with std::shuffle in tri #24062
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
Merged
Changes from 3 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
601d92a
removed RandomNumberGenerator class, included <random>, replaced rand…
tybeller 4bf6696
Merge branch 'matplotlib:main' into shuffleFix
tybeller 1ae3610
Create 24062-tb.rst
tybeller c8e0531
Update doc/api/next_api_changes/behavior/24062-tb.rst
tybeller bd3dc8a
Update doc/api/next_api_changes/behavior/24062-tb.rst
tybeller 4648dda
Update 24062-tb.rst
tybeller d77b191
Update 24062-tb.rst
tybeller 0427513
Merge branch 'matplotlib:main' into shuffleFix
tybeller c4fb35e
Merge branch 'matplotlib:main' into shuffleFix
tybeller e096d5e
Update 24062-tb.rst
tybeller cf0613b
Merge branch 'matplotlib:main' into shuffleFix
tybeller d2d0d11
removed random number generator from _tri.h
tybeller a06bae9
Update _tri.cpp
tybeller 3513a85
Update src/tri/_tri.h
oscargus 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| Change in TrapezoidMapTriFinder, triangulation interpolation, and refinement output due to change in shuffle. | ||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| With std::random_shuffle removed from C++17, TrapezouidMapTriFinder, triangular interpolation, and refinement now use std::shuffle with a new random generator leading to a different output. | ||
|
tybeller marked this conversation as resolved.
Outdated
|
||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,7 @@ | |
|
|
||
| #include <algorithm> | ||
| #include <set> | ||
| #include <random> | ||
|
|
||
|
|
||
| TriEdge::TriEdge() | ||
|
|
@@ -1465,8 +1466,8 @@ TrapezoidMapTriFinder::initialize() | |
| _tree->assert_valid(false); | ||
|
|
||
| // Randomly shuffle all edges other than first 2. | ||
| RandomNumberGenerator rng(1234); | ||
| std::random_shuffle(_edges.begin()+2, _edges.end(), rng); | ||
| std::mt19937 rng(1234); | ||
| std::shuffle(_edges.begin()+2, _edges.end(), rng); | ||
|
|
||
| // Add edges, one at a time, to tree. | ||
| size_t nedges = _edges.size(); | ||
|
|
@@ -2055,17 +2056,4 @@ TrapezoidMapTriFinder::Trapezoid::set_upper_right(Trapezoid* upper_right_) | |
| upper_right = upper_right_; | ||
| if (upper_right != 0) | ||
| upper_right->upper_left = this; | ||
| } | ||
|
|
||
|
|
||
|
|
||
| RandomNumberGenerator::RandomNumberGenerator(unsigned long seed) | ||
| : _m(21870), _a(1291), _c(4621), _seed(seed % _m) | ||
| {} | ||
|
|
||
| unsigned long | ||
| RandomNumberGenerator::operator()(unsigned long max_value) | ||
| { | ||
| _seed = (_seed*_a + _c) % _m; | ||
| return (_seed*max_value) / _m; | ||
| } | ||
| } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please end the file with an empty line. That will fix the pre-commit issue. (The pyside6 issue is fixed in #24158.) |
||
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.
would solve the failing doc build (if I got the length right...).
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.
If you're having trouble aligning the underline, then that's a sign the title is probably too long. I would leave out all of the details and just say "Change in triangulation output ..." Also, no trailing period in titles.