mirror of
https://github.com/magefree/mage.git
synced 2025-12-21 19:11:59 -08:00
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
|
|
@ -6,6 +6,7 @@ import mage.cards.repository.CardRepository;
|
|||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.util.RandomUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Date;
|
||||
|
|
@ -95,10 +96,9 @@ public class SystemUtil {
|
|||
continue;
|
||||
}
|
||||
|
||||
Random random = new Random();
|
||||
Set<Card> cardsToLoad = new HashSet<>();
|
||||
for (int i = 0; i < amount; i++) {
|
||||
CardInfo cardInfo = cards.get(random.nextInt(cards.size()));
|
||||
CardInfo cardInfo = cards.get(RandomUtil.nextInt(cards.size()));
|
||||
Card card = cardInfo != null ? cardInfo.getCard() : null;
|
||||
if (card != null) {
|
||||
cardsToLoad.add(card);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue