Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Unified Diff: client/prune_crash_reports_test.cc

Issue 1406733003: Declare the random number generator lambda for std::random_shuffle as a local. (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/prune_crash_reports_test.cc
diff --git a/client/prune_crash_reports_test.cc b/client/prune_crash_reports_test.cc
index 50a27e182e44de3faeada9035a7e3ec49f99234e..7ffe67bc09ece82623b0812fb695282fea8fc5df 100644
--- a/client/prune_crash_reports_test.cc
+++ b/client/prune_crash_reports_test.cc
@@ -207,9 +207,10 @@ TEST(PruneCrashReports, PruneOrder) {
reports.push_back(temp);
}
// The randomness from std::rand() is not, so use a better rand() instead.
- std::random_shuffle(reports.begin(), reports.end(), [](int rand_max) {
+ const auto random_generator = [](int rand_max) {
return base::RandUint64() % rand_max;
- });
+ };
+ std::random_shuffle(reports.begin(), reports.end(), random_generator);
std::vector<CrashReportDatabase::Report> pending_reports(
reports.begin(), reports.begin() + 5);
std::vector<CrashReportDatabase::Report> completed_reports(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698