Index: webrtc/test/random.cc |
diff --git a/webrtc/test/random.cc b/webrtc/test/random.cc |
index 8877ed4c20c5bdfca2fcef03806f8b84d64b92bb..6bc707976c7e65573832f840411b7f80bb4036a2 100644 |
--- a/webrtc/test/random.cc |
+++ b/webrtc/test/random.cc |
@@ -22,16 +22,16 @@ Random::Random(uint32_t seed) : a_(0x531FDB97 ^ seed), b_(0x6420ECA8 + seed) { |
} |
float Random::Rand() { |
- const float kScale = 1.0f / 0xffffffff; |
- float result = kScale * b_; |
+ const double kScale = 1.0f / 0xfffffffful; |
+ double result = kScale * b_; |
a_ ^= b_; |
b_ += a_; |
- return result; |
+ return static_cast<float>(result); |
} |
int Random::Rand(int low, int high) { |
RTC_DCHECK(low <= high); |
- float uniform = Rand() * (high - low + 1) + low; |
+ float uniform = Rand() * (high - low) + low; |
pbos-webrtc
2015/10/19 15:22:21
Wait, this actually causes a bad distribution, if
terelius
2015/10/19 15:27:23
I was actually about to file a bug about this inde
|
return static_cast<int>(uniform); |
} |