A
adrian.bartholomew
public Deck() {
reset();
try {
random = SecureRandom.getInstance(RANDOM_ALGORITHM);
} catch (NoSuchAlgorithmException e) {
throw new NoSecureRandomException(e);
}
}
public final void reset() {
cards.clear();
cards.addAll(Card.allCards);
}
public void shuffle() {
for (int i=0; i<10; i++) {
random.setSeed(System.currentTimeMillis());
Collections.shuffle(cards, random);
}
}
......
The above code works, except that after a while i begin to see the
same patterns in hands dealt.
I can predict what the other hands would hold and can continue with
correct anticipatory play.
This should not be.
As you can see, I have even tried shuffling 10 times each time.
Any help would be appreciated.
reset();
try {
random = SecureRandom.getInstance(RANDOM_ALGORITHM);
} catch (NoSuchAlgorithmException e) {
throw new NoSecureRandomException(e);
}
}
public final void reset() {
cards.clear();
cards.addAll(Card.allCards);
}
public void shuffle() {
for (int i=0; i<10; i++) {
random.setSeed(System.currentTimeMillis());
Collections.shuffle(cards, random);
}
}
......
The above code works, except that after a while i begin to see the
same patterns in hands dealt.
I can predict what the other hands would hold and can continue with
correct anticipatory play.
This should not be.
As you can see, I have even tried shuffling 10 times each time.
Any help would be appreciated.