I have a simple stack of strings to represent a card deck already and I need to randomly move the cards into a new deck. I initially was going to just use Collections.shuffle and be done with it, but one of the requirements is to use the random method and this is where I'm getting tripped up, I'm sure it's something super simple but the whole going from string to int thing still confuses me.
Here's my stack of cards.
import java.util.Stack;
public class Deck {
public static void main(String[] args) {
Stack<String> stackOfCards = new Stack<>();
stackOfCards.push("2Spade");
stackOfCards.push("3Spade");
stackOfCards.push("4Spade");
stackOfCards.push("5Spade");
stackOfCards.push("6Spade");
stackOfCards.push("7Spade");
stackOfCards.push("8Spade");
stackOfCards.push("9Spade");
stackOfCards.push("10Spade");
stackOfCards.push("JSpade");
stackOfCards.push("QSpade");
stackOfCards.push("KSpade");
stackOfCards.push("ASpade");
stackOfCards.push("2Diamond");
stackOfCards.push("3Diamond");
stackOfCards.push("4Diamond");
stackOfCards.push("5Diamond");
stackOfCards.push("6Diamond");
stackOfCards.push("7Diamond");
stackOfCards.push("8Diamond");
stackOfCards.push("9Diamond");
stackOfCards.push("10Diamond");
stackOfCards.push("JDiamond");
stackOfCards.push("QDiamond");
stackOfCards.push("KDiamond");
stackOfCards.push("ADiamond");
stackOfCards.push("2Club");
stackOfCards.push("3Club");
stackOfCards.push("4Club");
stackOfCards.push("5Club");
stackOfCards.push("6Club");
stackOfCards.push("7Club");
stackOfCards.push("8Club");
stackOfCards.push("9Club");
stackOfCards.push("10Club");
stackOfCards.push("JClub");
stackOfCards.push("QClub");
stackOfCards.push("KClub");
stackOfCards.push("AClub");
stackOfCards.push("2Heart");
stackOfCards.push("3Heart");
stackOfCards.push("4Heart");
stackOfCards.push("5Heart");
stackOfCards.push("6Heart");
stackOfCards.push("7Heart");
stackOfCards.push("8Heart");
stackOfCards.push("9Heart");
stackOfCards.push("10Heart");
stackOfCards.push("JHeart");
stackOfCards.push("QHeart");
stackOfCards.push("KHeart");
stackOfCards.push("AHeart");
System.out.println("Deck: " + stackOfCards);
}
}