From fd44975bc8a8b85831e1e153ce566dd2ef0a6b70 Mon Sep 17 00:00:00 2001 From: John Koleszar Date: Fri, 19 Apr 2013 08:57:03 -0700 Subject: [PATCH] Make Rand8Extremes more extreme Previous code didn't do what was expected, we want numbers within 16 of the extrema. Change-Id: I20c18627c482ec66e8405ddad74ca9276c0c65dc --- test/acm_random.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/acm_random.h b/test/acm_random.h index cd33d1268..56feaa234 100644 --- a/test/acm_random.h +++ b/test/acm_random.h @@ -38,7 +38,7 @@ class ACMRandom { // Returns a random value near 0 or near 255, to better exercise // saturation behavior. const uint8_t r = Rand8(); - return r < 128 ? r << 4 : r >> 4; + return r <= 128 ? 255 - (r >> 4) : r >> 4; } int PseudoUniform(int range) { -- 2.49.0