| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_METRICS_PERF_RANDOM_SELECTOR_H_ | 5 #ifndef CHROME_BROWSER_METRICS_PERF_RANDOM_SELECTOR_H_ |
| 6 #define CHROME_BROWSER_METRICS_PERF_RANDOM_SELECTOR_H_ | 6 #define CHROME_BROWSER_METRICS_PERF_RANDOM_SELECTOR_H_ |
| 7 | 7 |
| 8 #include <stddef.h> |
| 9 |
| 8 #include <string> | 10 #include <string> |
| 9 #include <vector> | 11 #include <vector> |
| 10 | 12 |
| 11 #include "base/macros.h" | 13 #include "base/macros.h" |
| 12 | 14 |
| 13 // RandomSelector can be used to pick vectors of strings according to certain | 15 // RandomSelector can be used to pick vectors of strings according to certain |
| 14 // probabilities. The probabilities are set using SetOdds(). A randomly picked | 16 // probabilities. The probabilities are set using SetOdds(). A randomly picked |
| 15 // vector can be obtained by calling Select(). | 17 // vector can be obtained by calling Select(). |
| 16 // | 18 // |
| 17 // Sample usage: | 19 // Sample usage: |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 // Sum of the probability weights. | 84 // Sum of the probability weights. |
| 83 double sum_of_weights_; | 85 double sum_of_weights_; |
| 84 | 86 |
| 85 DISALLOW_COPY_AND_ASSIGN(RandomSelector); | 87 DISALLOW_COPY_AND_ASSIGN(RandomSelector); |
| 86 }; | 88 }; |
| 87 | 89 |
| 88 ::std::ostream& operator<<( | 90 ::std::ostream& operator<<( |
| 89 ::std::ostream& os, const RandomSelector::WeightAndValue& value); | 91 ::std::ostream& os, const RandomSelector::WeightAndValue& value); |
| 90 | 92 |
| 91 #endif // CHROME_BROWSER_METRICS_PERF_RANDOM_SELECTOR_H_ | 93 #endif // CHROME_BROWSER_METRICS_PERF_RANDOM_SELECTOR_H_ |
| OLD | NEW |