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
|
|
@ -45,6 +45,7 @@ import mage.cards.Card;
|
|||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.game.Game;
|
||||
import mage.util.RandomUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -52,7 +53,6 @@ import mage.game.Game;
|
|||
*/
|
||||
public class Library implements Serializable {
|
||||
|
||||
private static Random rnd = new Random();
|
||||
|
||||
private boolean emptyDraw;
|
||||
private final Deque<UUID> library = new ArrayDeque<>();
|
||||
|
|
@ -76,7 +76,7 @@ public class Library implements Serializable {
|
|||
public void shuffle() {
|
||||
UUID[] shuffled = library.toArray(new UUID[0]);
|
||||
for (int n = shuffled.length - 1; n > 0; n--) {
|
||||
int r = rnd.nextInt(n);
|
||||
int r = RandomUtil.nextInt(n);
|
||||
UUID temp = shuffled[n];
|
||||
shuffled[n] = shuffled[r];
|
||||
shuffled[r] = temp;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue