refactor : removed all instances of new Random() and replaced with RandomUtil for a ThreadLocal randomizer

This commit is contained in:
ingmargoudt 2016-09-05 15:03:47 +02:00
parent f2cc8d4571
commit e2a479255a
51 changed files with 173 additions and 133 deletions

View file

@ -47,6 +47,7 @@ import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.players.Player;
import mage.util.RandomUtil;
/**
*
@ -322,7 +323,7 @@ public abstract class TargetImpl implements Target {
Set<UUID> possibleTargets = possibleTargets(source.getSourceId(), playerId, game);
if (possibleTargets.size() > 0) {
int i = 0;
int rnd = new Random().nextInt(possibleTargets.size());
int rnd = RandomUtil.nextInt(possibleTargets.size());
Iterator it = possibleTargets.iterator();
while (i < rnd) {
it.next();