Switch out random number generator for tests, benches, samples.
This change makes tests, benches and samples use the new SkMWCRandom PRNG. GMs will be saved for another time, as they'll require rebaselining.
R=reed@google.com, bsalomon@google.com
Author: jvanverth@google.com
Review URL: https://chromiumcodereview.appspot.com/23653018
git-svn-id: http://skia.googlecode.com/svn/trunk@11136 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tests/BitmapGetColorTest.cpp b/tests/BitmapGetColorTest.cpp
index 11c22e6..06e3760 100644
--- a/tests/BitmapGetColorTest.cpp
+++ b/tests/BitmapGetColorTest.cpp
@@ -10,11 +10,11 @@
#include "SkRect.h"
#include "SkRandom.h"
-static int nextRand(SkRandom& rand, int min, int max) {
+static int nextRand(SkMWCRandom& rand, int min, int max) {
return min + (int)rand.nextRangeU(0, max - min);
}
-static void rand_irect(SkIRect* rect, int W, int H, SkRandom& rand) {
+static void rand_irect(SkIRect* rect, int W, int H, SkMWCRandom& rand) {
const int DX = W / 2;
const int DY = H / 2;
@@ -57,7 +57,7 @@
bm8.setConfig(SkBitmap::kA8_Config, W, H);
bm8.allocPixels();
- SkRandom rand;
+ SkMWCRandom rand;
for (int i = 0; i < 10000; ++i) {
SkIRect area;
rand_irect(&area, W, H, rand);
diff --git a/tests/MathTest.cpp b/tests/MathTest.cpp
index fe54594..5ec91a9 100644
--- a/tests/MathTest.cpp
+++ b/tests/MathTest.cpp
@@ -19,7 +19,7 @@
REPORTER_ASSERT(reporter, 1 == SkCLZ(1 << 30));
REPORTER_ASSERT(reporter, 0 == SkCLZ(~0U));
- SkRandom rand;
+ SkMWCRandom rand;
for (int i = 0; i < 1000; ++i) {
uint32_t mask = rand.nextU();
// need to get some zeros for testing, but in some obscure way so the
@@ -82,7 +82,7 @@
}
#endif
- SkRandom rand;
+ SkMWCRandom rand;
for (int i = 0; i < 10000; ++i) {
unsigned a = rand.nextU() & 0x7FFF;
unsigned b = rand.nextU() & 0x7FFF;
diff --git a/tests/MatrixTest.cpp b/tests/MatrixTest.cpp
index 70d2c1d..0f4973f 100644
--- a/tests/MatrixTest.cpp
+++ b/tests/MatrixTest.cpp
@@ -574,7 +574,7 @@
const int kTripleCount = 1000;
const int kMatrixCount = 1000;
- SkRandom rand;
+ SkMWCRandom rand;
SkScalar randTriples[3*kTripleCount];
for (int i = 0; i < 3*kTripleCount; ++i) {
diff --git a/tests/MipMapTest.cpp b/tests/MipMapTest.cpp
index 3988273..5862d08 100644
--- a/tests/MipMapTest.cpp
+++ b/tests/MipMapTest.cpp
@@ -10,7 +10,7 @@
#include "SkBitmap.h"
#include "SkRandom.h"
-static void make_bitmap(SkBitmap* bm, SkRandom& rand) {
+static void make_bitmap(SkBitmap* bm, SkMWCRandom& rand) {
// for now, Build needs a min size of 2, otherwise it will return NULL.
// should fix that to support 1 X N, where N > 1 to return non-null.
int w = 2 + rand.nextU() % 1000;
@@ -22,7 +22,7 @@
static void TestMipMap(skiatest::Reporter* reporter) {
SkBitmap bm;
- SkRandom rand;
+ SkMWCRandom rand;
for (int i = 0; i < 500; ++i) {
make_bitmap(&bm, rand);
diff --git a/tests/PaintTest.cpp b/tests/PaintTest.cpp
index 38f66ea..a7bbffa 100644
--- a/tests/PaintTest.cpp
+++ b/tests/PaintTest.cpp
@@ -71,7 +71,7 @@
{ uni_to_utf32, SkPaint::kUTF32_TextEncoding },
};
- SkRandom rand;
+ SkMWCRandom rand;
SkPaint paint;
paint.setTypeface(SkTypeface::RefDefault())->unref();
SkTypeface* face = paint.getTypeface();