OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef NET_HTTP2_TOOLS_HTTP2_RANDOM_H_ | |
6 #define NET_HTTP2_TOOLS_HTTP2_RANDOM_H_ | |
7 | |
8 #include <stdint.h> | |
9 | |
10 #include <string> | |
11 | |
12 namespace net { | |
13 namespace test { | |
14 | |
15 class RandomBase { | |
16 public: | |
17 virtual ~RandomBase() {} | |
18 virtual bool OneIn(int n) = 0; | |
19 virtual int32_t Uniform(int32_t n) = 0; | |
20 virtual uint8_t Rand8() = 0; | |
21 virtual uint16_t Rand16() = 0; | |
22 virtual uint32_t Rand32() = 0; | |
23 virtual uint64_t Rand64() = 0; | |
24 virtual int32_t Next() = 0; | |
25 virtual int32_t Skewed(int max_log) = 0; | |
26 virtual std::string RandString(int length) = 0; | |
27 }; | |
28 | |
29 class Http2Random : public RandomBase { | |
30 public: | |
31 ~Http2Random() override {} | |
32 bool OneIn(int n) override; | |
33 int32_t Uniform(int32_t n) override; | |
34 uint8_t Rand8() override; | |
35 uint16_t Rand16() override; | |
36 uint32_t Rand32() override; | |
37 uint64_t Rand64() override; | |
38 int32_t Next() override; | |
39 int32_t Skewed(int max_log) override; | |
40 std::string RandString(int length) override; | |
41 }; | |
42 | |
43 } // namespace test | |
44 } // namespace net | |
45 | |
46 #endif // NET_HTTP2_TOOLS_HTTP2_RANDOM_H_ | |
OLD | NEW |