Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. import java.util.Random;
  2.  
  3. public class Deck {
  4.     private Card[] cards;
  5.     int i;
  6.     Main m = new Main();
  7.     int y = m.GetInput();
  8.  
  9.     Deck(){
  10.         i=y;
  11.         cards = new Card[52];
  12.         int x=0;
  13.         for (int a=0; a<=3; a++){
  14.             for (int b=0; b<=12; b++){
  15.                 cards[x] = new Card(a,b);
  16.                 x++;
  17.                 }
  18.             }
  19.         }
  20.  
  21.     public Card drawFromDeck(){
  22.         Random generator = new Random();
  23.         int index=0;
  24.  
  25.         do{
  26.             index = generator.nextInt( 52 );
  27.             } while (cards[index] == null);
  28.  
  29.         i--;
  30.         Card temp = cards[index];
  31.         cards[index]= null;
  32.         return temp;
  33.     }
  34.     public int getTotalCards(){
  35.         return i;
  36.     }
  37. }