srand() + rand() -> SkRandom

rand() makes these two GMs thread-unsafe.  When run concurrently they can
interfere with each other.  Use SkRandom instead to guarantee independence.

BUG=skia:1590
R=jvanverth@google.com

Review URL: https://codereview.chromium.org/24105003

git-svn-id: http://skia.googlecode.com/svn/trunk@11295 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gm/imagemagnifier.cpp b/gm/imagemagnifier.cpp
index 0966121..a5f942d 100644
--- a/gm/imagemagnifier.cpp
+++ b/gm/imagemagnifier.cpp
@@ -7,6 +7,7 @@
 
 #include "gm.h"
 #include "SkMagnifierImageFilter.h"
+#include "SkRandom.h"
 
 #define WIDTH 500
 #define HEIGHT 500
@@ -44,12 +45,12 @@
         canvas->saveLayer(NULL, &paint);
         paint.setAntiAlias(true);
         const char* str = "The quick brown fox jumped over the lazy dog.";
-        srand(1234);
+        SkRandom rand;
         for (int i = 0; i < 25; ++i) {
-            int x = rand() % WIDTH;
-            int y = rand() % HEIGHT;
-            paint.setColor(rand() % 0x1000000 | 0xFF000000);
-            paint.setTextSize(SkIntToScalar(rand() % 300));
+            int x = rand.nextULessThan(WIDTH);
+            int y = rand.nextULessThan(HEIGHT);
+            paint.setColor(rand.nextBits(24) | 0xFF000000);
+            paint.setTextSize(rand.nextULessThan(300));
             canvas->drawText(str, strlen(str), SkIntToScalar(x),
                              SkIntToScalar(y), paint);
         }