stefan | c62642c | 2015-07-07 04:20:34 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license |
| 5 | * that can be found in the LICENSE file in the root of the source |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
solenberg | 5bdddf9 | 2015-10-15 05:10:30 -0700 | [diff] [blame^] | 11 | #ifndef WEBRTC_TEST_RANDOM_H_ |
| 12 | #define WEBRTC_TEST_RANDOM_H_ |
stefan | c62642c | 2015-07-07 04:20:34 -0700 | [diff] [blame] | 13 | |
| 14 | #include "webrtc/typedefs.h" |
| 15 | #include "webrtc/base/constructormagic.h" |
| 16 | |
| 17 | namespace webrtc { |
| 18 | |
solenberg | 5bdddf9 | 2015-10-15 05:10:30 -0700 | [diff] [blame^] | 19 | namespace test { |
| 20 | |
stefan | c62642c | 2015-07-07 04:20:34 -0700 | [diff] [blame] | 21 | class Random { |
| 22 | public: |
| 23 | explicit Random(uint32_t seed); |
| 24 | |
| 25 | // Return pseudo-random number in the interval [0.0, 1.0]. |
| 26 | float Rand(); |
| 27 | |
solenberg | 5bdddf9 | 2015-10-15 05:10:30 -0700 | [diff] [blame^] | 28 | // Return pseudo rounded random number in interval [low, high]. |
| 29 | int Rand(int low, int high); |
| 30 | |
stefan | c62642c | 2015-07-07 04:20:34 -0700 | [diff] [blame] | 31 | // Normal Distribution. |
| 32 | int Gaussian(int mean, int standard_deviation); |
| 33 | |
solenberg | 5bdddf9 | 2015-10-15 05:10:30 -0700 | [diff] [blame^] | 34 | // Exponential Distribution. |
| 35 | int Exponential(float lambda); |
| 36 | |
stefan | c62642c | 2015-07-07 04:20:34 -0700 | [diff] [blame] | 37 | // TODO(solenberg): Random from histogram. |
| 38 | // template<typename T> int Distribution(const std::vector<T> histogram) { |
| 39 | |
| 40 | private: |
| 41 | uint32_t a_; |
| 42 | uint32_t b_; |
| 43 | |
henrikg | 3c089d7 | 2015-09-16 05:37:44 -0700 | [diff] [blame] | 44 | RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(Random); |
stefan | c62642c | 2015-07-07 04:20:34 -0700 | [diff] [blame] | 45 | }; |
solenberg | 5bdddf9 | 2015-10-15 05:10:30 -0700 | [diff] [blame^] | 46 | } // namespace test |
stefan | c62642c | 2015-07-07 04:20:34 -0700 | [diff] [blame] | 47 | } // namespace webrtc |
| 48 | |
solenberg | 5bdddf9 | 2015-10-15 05:10:30 -0700 | [diff] [blame^] | 49 | #endif // WEBRTC_TEST_RANDOM_H_ |