Basically I have an array os strings (representing all the cards from my deck) and I need and can't figure out how to prepperly shuffle this deck and distribute 5 cards.
I've got it working some way, but I'm sure this is not the best way, because sometimes the card repeats when I deal it, and basically none of my cards can repeat.
I thought about copying my main array to another array and remove the cards already dealt from thi array, that way, everythime I pick one card it would necessarily be a different one, but I'm sure this is still not the best approach.
My idea was to shuffle this array, and then to display the fisrt five cards, I could just loop from 0 to 4, 'cause as the array is shuffled, it wouldn't be a problem, but then when I need more cards I would have to have a counter to know from which position to take the next card, so that's why it wouyld be best to remove the cards from the array, but I can't figure out how to do that.
To sum up, what I need is:
- Shuffle the contents of my array
- Have a function to get the first item and remove it from the array, so that way I would just call a function like getCard() as many times as I needed it.
Thanks in advance