OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/common/metrics/entropy_provider.h" | 5 #include "components/variations/entropy_provider.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/rand_util.h" | 12 #include "base/rand_util.h" |
13 #include "base/sha1.h" | 13 #include "base/sha1.h" |
14 #include "base/sys_byteorder.h" | 14 #include "base/sys_byteorder.h" |
15 #include "chrome/common/metrics/metrics_util.h" | 15 #include "components/variations/metrics_util.h" |
16 | 16 |
17 namespace metrics { | 17 namespace metrics { |
18 | 18 |
19 namespace internal { | 19 namespace internal { |
20 | 20 |
21 SeededRandGenerator::SeededRandGenerator(uint32 seed) { | 21 SeededRandGenerator::SeededRandGenerator(uint32 seed) { |
22 mersenne_twister_.init_genrand(seed); | 22 mersenne_twister_.init_genrand(seed); |
23 } | 23 } |
24 | 24 |
25 SeededRandGenerator::~SeededRandGenerator() { | 25 SeededRandGenerator::~SeededRandGenerator() { |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 } | 110 } |
111 | 111 |
112 uint16 PermutedEntropyProvider::GetPermutedValue( | 112 uint16 PermutedEntropyProvider::GetPermutedValue( |
113 uint32 randomization_seed) const { | 113 uint32 randomization_seed) const { |
114 std::vector<uint16> mapping(low_entropy_source_max_); | 114 std::vector<uint16> mapping(low_entropy_source_max_); |
115 internal::PermuteMappingUsingRandomizationSeed(randomization_seed, &mapping); | 115 internal::PermuteMappingUsingRandomizationSeed(randomization_seed, &mapping); |
116 return mapping[low_entropy_source_]; | 116 return mapping[low_entropy_source_]; |
117 } | 117 } |
118 | 118 |
119 } // namespace metrics | 119 } // namespace metrics |
OLD | NEW |