]> granicus.if.org Git - libvpx/commitdiff
Make Rand8Extremes more extreme
authorJohn Koleszar <jkoleszar@google.com>
Fri, 19 Apr 2013 15:57:03 +0000 (08:57 -0700)
committerGerrit Code Review <gerrit@gerrit.golo.chromium.org>
Wed, 18 Sep 2013 00:45:34 +0000 (17:45 -0700)
Previous code didn't do what was expected, we want numbers within 16 of
the extrema.

Change-Id: I20c18627c482ec66e8405ddad74ca9276c0c65dc

test/acm_random.h

index cd33d1268126380fdb3eef0c8e7a8d571b1b8a25..56feaa234c2bbdaacee84088130f7fed41c25684 100644 (file)
@@ -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) {