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

@ -135,13 +135,13 @@ import mage.target.common.TargetCardInLibrary;
import mage.target.common.TargetDiscard;
import mage.util.CardUtil;
import mage.util.GameLog;
import mage.util.RandomUtil;
import org.apache.log4j.Logger;
public abstract class PlayerImpl implements Player, Serializable {
private static final Logger logger = Logger.getLogger(PlayerImpl.class);
private static Random rnd = new Random();
private static SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss.SSS");
/**
@ -2329,7 +2329,7 @@ public abstract class PlayerImpl implements Player, Serializable {
*/
@Override
public boolean flipCoin(Game game, ArrayList<UUID> appliedEffects) {
boolean result = rnd.nextBoolean();
boolean result = RandomUtil.nextBoolean();
if (!game.isSimulation()) {
game.informPlayers("[Flip a coin] " + getLogName() + (result ? " won (head)." : " lost (tail)."));
}