Use RandomUtil.getChance()

git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@673 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
Dave Hoover
2008-10-22 17:26:51 +00:00
parent e2e3243a29
commit 4c9ac3ad6f
2 changed files with 4 additions and 4 deletions
@@ -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
@@ -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