From 4c9ac3ad6ff34c3c625abb19732f967fc7ecc4fb Mon Sep 17 00:00:00 2001 From: Dave Hoover Date: Wed, 22 Oct 2008 17:26:51 +0000 Subject: [PATCH] Use RandomUtil.getChance() git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@673 ed5b42cb-e716-0410-a449-f6a68f950b19 --- src/java/com/threerings/media/animation/BobbleAnimation.java | 4 ++-- src/java/com/threerings/media/animation/SparkAnimation.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/java/com/threerings/media/animation/BobbleAnimation.java b/src/java/com/threerings/media/animation/BobbleAnimation.java index 9e567954..0e129bc7 100644 --- a/src/java/com/threerings/media/animation/BobbleAnimation.java +++ b/src/java/com/threerings/media/animation/BobbleAnimation.java @@ -75,8 +75,8 @@ public class BobbleAnimation extends Animation // calculate the latest position int dx = RandomUtil.getInt(_rx); int dy = RandomUtil.getInt(_ry); - _x = _sx + dx * ((RandomUtil.getInt(2) == 0) ? -1 : 1); - _y = _sy + dy * ((RandomUtil.getInt(2) == 0) ? -1 : 1); + _x = _sx + dx * (RandomUtil.getChance(2) ? -1 : 1); + _y = _sy + dy * (RandomUtil.getChance(2) ? -1 : 1); } @Override diff --git a/src/java/com/threerings/media/animation/SparkAnimation.java b/src/java/com/threerings/media/animation/SparkAnimation.java index 2d7c2f0f..b8bdc716 100644 --- a/src/java/com/threerings/media/animation/SparkAnimation.java +++ b/src/java/com/threerings/media/animation/SparkAnimation.java @@ -84,7 +84,7 @@ public class SparkAnimation extends Animation for (int ii = 0; ii < _icount; ii++) { // initialize spark position - _ox[ii] = x + + _ox[ii] = x + ((xjog == 0) ? 0 : RandomUtil.getInt(xjog) * randomDirection()); _oy[ii] = y + ((yjog == 0) ? 0 : RandomUtil.getInt(yjog) * randomDirection()); @@ -120,7 +120,7 @@ public class SparkAnimation extends Animation */ protected int randomDirection () { - return (RandomUtil.getInt(2) == 0) ? -1 : 1; + return RandomUtil.getChance(2) ? -1 : 1; } @Override