mirror of
https://github.com/chromium/crashpad.git
synced 2025-03-09 14:06:33 +00:00
Use an even better random number generation scheme in the prune test
base::RandInt(0, max - 1) has a uniform distribution. base::RandUint64() % max does not. TEST=crashpad_client_test PruneCrashReports.PruneOrder R=rsesek@chromium.org Review URL: https://codereview.chromium.org/1417443002 .
This commit is contained in:
parent
30678f1e82
commit
07dbc3259c
@ -208,7 +208,7 @@ TEST(PruneCrashReports, PruneOrder) {
|
||||
}
|
||||
// The randomness from std::rand() is not, so use a better rand() instead.
|
||||
const auto random_generator = [](int rand_max) {
|
||||
return base::RandUint64() % rand_max;
|
||||
return base::RandInt(0, rand_max - 1);
|
||||
};
|
||||
std::random_shuffle(reports.begin(), reports.end(), random_generator);
|
||||
std::vector<CrashReportDatabase::Report> pending_reports(
|
||||
|
Loading…
x
Reference in New Issue
Block a user