分享一下我的代码
import java.util.ArrayList;
import java.util.Random;
public class Pokegame{
ArrayList<Poke> cards = new ArrayList<Poke>();
public void init(){
for(int i = 1;i<=13;i++){
for(int j =1;j<=4;j++){
cards.add(new Poke(i,j));
}
}
}
public void flushCards(){
Random random = new Random();
for(int i =0;i<100;i++){
Poke a = cards.get(random.nextInt(52));
cards.remove(a);
cards.add(a);
}
}
public void show(){
for (Poke poke : cards) {
System.out.println(poke);
}
}
public static void main(String[] args) {
Pokegame game =new Pokegame();
game.init();
game.flushCards();
game.show();
}
}