aboutsummaryrefslogtreecommitdiff
path: root/test/acm_random.h
diff options
context:
space:
mode:
Diffstat (limited to 'test/acm_random.h')
-rw-r--r--test/acm_random.h15
1 files changed, 5 insertions, 10 deletions
diff --git a/test/acm_random.h b/test/acm_random.h
index c7122b933..e3520c47d 100644
--- a/test/acm_random.h
+++ b/test/acm_random.h
@@ -45,16 +45,11 @@ class ACMRandom {
return static_cast<int16_t>(random_.Generate(65536));
}
- int16_t Rand13Signed() {
- // Use 13 bits: values between 4095 and -4096.
- const uint32_t value = random_.Generate(8192);
- return static_cast<int16_t>(value) - 4096;
- }
-
- int16_t Rand9Signed() {
- // Use 9 bits: values between 255 (0x0FF) and -256 (0x100).
- const uint32_t value = random_.Generate(512);
- return static_cast<int16_t>(value) - 256;
+ uint16_t Rand12() {
+ const uint32_t value =
+ random_.Generate(testing::internal::Random::kMaxRange);
+ // There's a bit more entropy in the upper bits of this implementation.
+ return (value >> 19) & 0xfff;
}
uint8_t Rand8() {