forked from External/mage
refactor : removed all instances of new Random() and replaced with RandomUtil for a ThreadLocal randomizer
This commit is contained in:
parent
f2cc8d4571
commit
e2a479255a
51 changed files with 173 additions and 133 deletions
|
|
@ -124,6 +124,7 @@ import mage.target.TargetPermanent;
|
|||
import mage.target.TargetPlayer;
|
||||
import mage.util.GameLog;
|
||||
import mage.util.MessageToClient;
|
||||
import mage.util.RandomUtil;
|
||||
import mage.util.functions.ApplyToPermanent;
|
||||
import mage.watchers.Watchers;
|
||||
import mage.watchers.common.BlockedAttackerWatcher;
|
||||
|
|
@ -159,7 +160,6 @@ public abstract class GameImpl implements Game, Serializable {
|
|||
FILTER_LEGENDARY.add(new SupertypePredicate("Legendary"));
|
||||
}
|
||||
|
||||
private static Random rnd = new Random();
|
||||
|
||||
private transient Object customData;
|
||||
protected boolean simulation = false;
|
||||
|
|
@ -1098,7 +1098,7 @@ public abstract class GameImpl implements Game, Serializable {
|
|||
UUID[] players = getPlayers().keySet().toArray(new UUID[0]);
|
||||
UUID playerId;
|
||||
while (!hasEnded()) {
|
||||
playerId = players[rnd.nextInt(players.length)];
|
||||
playerId = players[RandomUtil.nextInt(players.length)];
|
||||
Player player = getPlayer(playerId);
|
||||
if (player != null && player.isInGame()) {
|
||||
fireInformEvent(state.getPlayer(playerId).getLogName() + " won the toss");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue