   Advice on improving this code?
  Alright, so like I mentioned in my previous threads, I'm doing some practice in Java before AP Computer Science starts. After reading through a few sets of tutorials on Sun's website, I finally got a simple game running. It's basically a clone of the War (you know, the cards game). import java.io.*; import java.util.Scanner; import java.util.Random; /* *  A simple card game of War! */class Card{public enum Suit { HEART, DIAMOND, SPADE, CLUB }public enum Rank { TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, TEN, JACK, QUEEN, KING, ACE }private Rank rank; private Suit suit;public Card(){// Assign a default card: Ace of Heartsthis.rank = Rank.ACE; this.suit = Suit.HEART; }public Card(Rank rank, Suit suit){ this.rank = rank; this.suit = suit; }public String toString(){return rank + " of " + suit;}public int getRankValue(){int[] table = { 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }; int count = 0; for (Rank rank : Rank.values()){if (this.rank == rank){return table[count]; }count++; }return -1; }public Rank getRank(){return this.rank;}public Suit getSuit(){return this.suit; }}class Deck{private Card[] cards; private int length = 0; private final int MAX_DECK_LENGTH = 500; public Deck(){// Create deckthis.cards = new Card[MAX_DECK_LENGTH]; for (Card.Rank rank : Card.Rank.values()){for (Card.Suit suit : Card.Suit.values()){this.addCard(new Card(rank, suit));}}}public void addCard(Card card){this.cards[this.length++] = card; }public void deleteCard(int index){if (index >= 0 && index <= this.cards.length - 1){this.cards[index] = null;this.length--; }}public Card getCard(int index){return (index >= 0 && index <= this.cards.length - 1) ? (this.cards[index] != null) ? this.cards[index] : new Card(Card.Rank.TWO, Card.Suit.HEART) : null;}public int getLength(){return this.length; }}class JApp{final static int PLAYER_WIN = 1; final static int COMPUTER_WIN = 2; final static int CONTINUE = 3; public static int doGame(Deck player, Deck computer){// Create a scanner to handle input (in this case enter key presses)Scanner scanner = new Scanner(System.in);// Draw random card from each playerint pcIndex = (new Random(new Random().nextInt()).nextInt(player.getLength()));int ccIndex = (new Random(new Random().nextInt()).nextInt(computer.getLength()));// Attack!int playerAttack = player.getCard(pcIndex).getRankValue();int computerAttack = computer.getCard(ccIndex).getRankValue();System.out.println("Player: " + player.getCard(pcIndex).toString());System.out.println("Computer: " + computer.getCard(ccIndex).toString());if (playerAttack > computerAttack){player.addCard(computer.getCard(ccIndex));computer.deleteCard(ccIndex);System.out.println("You win this round!");}else if (computerAttack > playerAttack){computer.addCard(player.getCard(pcIndex));player.deleteCard(pcIndex);System.out.println("You lost this round!");}else{// Delete both cardsplayer.deleteCard(pcIndex);computer.deleteCard(ccIndex);System.out.println("Round tied! Both cards destroyed!");}System.out.println("Player: " + player.getLength() + " | Computer: " + computer.getLength() + "\n");// Take enter key press then continuescanner.nextLine();// Check for victory or lossesif (player.getLength() == 0 && computer.getLength() > 0){return COMPUTER_WIN;}else if (computer.getLength() == 0 && player.getLength() > 0){return PLAYER_WIN;}return CONTINUE; }public static void main(String[] args){Deck player = new Deck();Deck computer = new Deck();int status = CONTINUE; do{status = doGame(player, computer);} while (status == CONTINUE);System.out.println((status == PLAYER_WIN) ? "You have won!" : "You have lost!");}}Can you give me any advice on improving this code? Also it would be nice to hear some suggestions on other, slightly more complex games that I could create (keep in mind that what I am capable of making right now is still limited to the command line). School starts tomorrow so if you're going to give an idea, please make sure that it can be done in under 500 lines of code. Thanks.   
Quote:int pcIndex = (new Random(new Random().nextInt()).nextInt(player.getLength()))Allocate Random once and store it. Doing the above is similar to calling srand() before every rand().   