Sorry if this is long but i'm writing a program that draws a poker hand(5 different cards) from a standard deck of 52. The only part Im still struggling with is getting different cards. The code I have now is as simple as it gets and works for the most part but sometimes can draw the same card more than once. I want the card to be removed from the deck once its drawn and i'm stuck on that part.
Card[] hand = new Card[5];
for (int i = 0; i < 5; i += 1)
{
int index = rand.nextInt(52);
hand[i] = cards[index];
}
return hand;