import java.util.Random; import se.lth.cs.p.ovn.cardGames.Card; class CardDeck{ private Card[] theCards; private Random rand; int k; public CardDeck(){ theCards=new Card[52]; k=0; for(int i=1; i<=4; i++){ for(int t=1; t<=13; t++){ theCards[k]= new Card(i, t); k++; } } } public void shuffle(){ rand=new Random(); int rnd, temp; for(int i=51; i>=1; i--){ int nr = rand.nextInt(i); Card swap = theCards[nr]; theCards[nr] = theCards[i]; theCards[i] = swap; } } public boolean moreCards(){ return(k>=0); } public Card getCard(){ Card ret=theCards[51-k]; k--; return ret; } }