Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Unified Diff: webrtc/test/random.h

Issue 1404953002: Move PRNG from BWE test framework to webrtc/test. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/test/random.h
diff --git a/webrtc/modules/remote_bitrate_estimator/test/random.h b/webrtc/test/random.h
similarity index 76%
rename from webrtc/modules/remote_bitrate_estimator/test/random.h
rename to webrtc/test/random.h
index 31c1ec142ebaa7aa8db0c6a5d680a1191418b65a..9a0bc9e9532aae2b70673c72f4085e2961e66cb2 100644
--- a/webrtc/modules/remote_bitrate_estimator/test/random.h
+++ b/webrtc/test/random.h
@@ -8,14 +8,16 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#ifndef WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_RANDOM_H_
-#define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_RANDOM_H_
+#ifndef WEBRTC_TEST_RANDOM_H_
+#define WEBRTC_TEST_RANDOM_H_
#include "webrtc/typedefs.h"
#include "webrtc/base/constructormagic.h"
namespace webrtc {
+namespace test {
+
class Random {
public:
explicit Random(uint32_t seed);
@@ -23,9 +25,15 @@ class Random {
// Return pseudo-random number in the interval [0.0, 1.0].
pbos-webrtc 2015/10/15 10:28:02 Is this 1.0 inclusive?
the sun 2015/10/16 21:50:31 Yes, that is why it says so. :) https://en.wikiped
pbos-webrtc 2015/10/19 13:33:01 I thought [0.0, 1.0) was the "standard" one, since
the sun 2015/10/19 15:10:25 Acknowledged.
float Rand();
+ // Return pseudo rounded random number in interval [low, high].
+ int Rand(int low, int high);
pbos-webrtc 2015/10/15 10:28:02 pseudo-random number mapped to the interval
+
// Normal Distribution.
int Gaussian(int mean, int standard_deviation);
+ // Exponential Distribution.
+ int Exponential(float lambda);
+
// TODO(solenberg): Random from histogram.
// template<typename T> int Distribution(const std::vector<T> histogram) {
@@ -35,6 +43,7 @@ class Random {
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(Random);
};
+} // namespace test
} // namespace webrtc
-#endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_RANDOM_H_
+#endif // WEBRTC_TEST_RANDOM_H_

Powered by Google App Engine
This is Rietveld 408576698