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
Changes from 4 commits
601d92a
4bf6696
1ae3610
c8e0531
bd3dc8a
4648dda
d77b191
0427513
c4fb35e
e096d5e
cf0613b
d2d0d11
a06bae9
3513a85
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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, TrapezoidMapTriFinder, triangular grid interpolation and refinement now use std::shuffle with a new random generator which may give different results. | ||
|
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. Different results how? Does a plot change? Is the order different? This is too vague and as a user I have no idea whether I need to do anything here. Also, please word-wrap lines at 80 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.) |
||
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.