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

Unified Diff: utils.cc

Issue 3173041: Add 10 minute random fuzz to automatic update check event schedule. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git
Patch Set: review comments Created 10 years, 4 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 | « utils.h ('k') | utils_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils.cc
diff --git a/utils.cc b/utils.cc
index cf1c3f5f11fcfe7fa2af0cf0a80c2f20cfa0a6d2..246bfaa74e94ed8abe414fc50ab701b5668913ad 100644
--- a/utils.cc
+++ b/utils.cc
@@ -20,6 +20,7 @@
#include "base/file_path.h"
#include "base/file_util.h"
+#include "base/rand_util.h"
#include "base/string_util.h"
#include "base/logging.h"
#include "update_engine/file_writer.h"
@@ -457,6 +458,12 @@ int ComparePriorities(ProcessPriority priority_lhs,
return static_cast<int>(priority_rhs) - static_cast<int>(priority_lhs);
}
+int FuzzInt(int value, unsigned int range) {
+ int min = value - range / 2;
+ int max = value + range - range / 2;
+ return base::RandInt(min, max);
+}
+
const char* const kStatefulPartition = "/mnt/stateful_partition";
} // namespace utils
« no previous file with comments | « utils.h ('k') | utils_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698