Quick fix to get random shuffling.

This commit is contained in:
LevelX2 2016-09-10 19:39:59 +02:00
parent bb8326d46b
commit d0a570aeee
3 changed files with 8 additions and 8 deletions

View file

@ -38,13 +38,13 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import java.util.UUID;
import mage.cards.Card;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.game.Game;
import mage.util.RandomUtil;
/**
*
@ -52,6 +52,7 @@ import mage.util.RandomUtil;
*/
public class Library implements Serializable {
private static Random rnd = new Random();
private boolean emptyDraw;
private final Deque<UUID> library = new ArrayDeque<>();
private final UUID playerId;
@ -74,7 +75,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 = RandomUtil.nextInt(n);
int r = rnd.nextInt(n);
UUID temp = shuffled[n];
shuffled[n] = shuffled[r];
shuffled[r] = temp;