summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNarayan Kamath <narayan@google.com>2017-03-09 11:13:35 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2017-03-09 11:13:39 +0000
commita444636d399672212cdc7ef46aa38d35f069a93b (patch)
tree7050ef59c70c5c513ce74f75218ceaf0d7645952 /tests
parenta355edf4e9fc8c5a93871b5df0e1f25b32c94beb (diff)
parentb192344234dcee215462e6218cf1c4384b9916f1 (diff)
Merge "MathUtils: Remove static Random field."
Diffstat (limited to 'tests')
-rw-r--r--tests/HwAccelerationTest/src/com/android/test/hwui/PathDestructionActivity.java18
1 files changed, 11 insertions, 7 deletions
diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/PathDestructionActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/PathDestructionActivity.java
index 4177725e3847..5cede6540410 100644
--- a/tests/HwAccelerationTest/src/com/android/test/hwui/PathDestructionActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/PathDestructionActivity.java
@@ -25,6 +25,8 @@ import android.os.Bundle;
import android.util.MathUtils;
import android.view.View;
+import java.util.Random;
+
/**
* The point of this test is to ensure that we can cause many paths to be created, drawn,
* and destroyed without causing hangs or crashes. This tests the native reference counting
@@ -57,10 +59,11 @@ public class PathDestructionActivity extends Activity {
private Path getRandomPath() {
float left, top, right, bottom;
- left = MathUtils.random(getWidth() - MIN_SIZE);
- top = MathUtils.random(getHeight() - MIN_SIZE);
- right = left + MathUtils.random(getWidth() - left);
- bottom = top + MathUtils.random(getHeight() - top);
+ Random r = new Random();
+ left = r.nextFloat() * (getWidth() - MIN_SIZE);
+ top = r.nextFloat() * (getHeight() - MIN_SIZE);
+ right = left + r.nextFloat() * (getWidth() - left);
+ bottom = top + r.nextFloat() * (getHeight() - top);
Path path = new Path();
path.moveTo(left, top);
path.lineTo(right, top);
@@ -71,9 +74,10 @@ public class PathDestructionActivity extends Activity {
}
private int getRandomColor() {
- int red = MathUtils.random(255);
- int green = MathUtils.random(255);
- int blue = MathUtils.random(255);
+ Random r = new Random();
+ int red = r.nextInt(255);
+ int green = r.nextInt(255);
+ int blue = r.nextInt(255);
return 0xff000000 | red << 16 | green << 8 | blue;
}