| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "net/http2/tools/http2_random.h" | 5 #include "net/http2/tools/http2_random.h" |
| 6 | 6 |
| 7 #include <limits> | |
| 8 #include <memory> | 7 #include <memory> |
| 9 | 8 |
| 10 #include "base/rand_util.h" | 9 #include "base/rand_util.h" |
| 11 | 10 |
| 12 namespace net { | 11 namespace net { |
| 13 namespace test { | 12 namespace test { |
| 14 | 13 |
| 15 bool Http2Random::OneIn(int n) { | 14 bool Http2Random::OneIn(int n) { |
| 16 return base::RandGenerator(n) == 0; | 15 return base::RandGenerator(n) == 0; |
| 17 } | 16 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 } | 49 } |
| 51 | 50 |
| 52 std::string Http2Random::RandString(int length) { | 51 std::string Http2Random::RandString(int length) { |
| 53 std::unique_ptr<char[]> buffer(new char[length]); | 52 std::unique_ptr<char[]> buffer(new char[length]); |
| 54 base::RandBytes(buffer.get(), length); | 53 base::RandBytes(buffer.get(), length); |
| 55 return std::string(buffer.get(), length); | 54 return std::string(buffer.get(), length); |
| 56 } | 55 } |
| 57 | 56 |
| 58 } // namespace test | 57 } // namespace test |
| 59 } // namespace net | 58 } // namespace net |
| OLD | NEW |