As English is not my first language, i sometimes have trouble understanding a teacher's instructions as to what she wants. I will be providing the instruction of what she wants, the code i made, and my problem.
Instruction: • Has a private method to “shuffle” that creates a Queue with the 52 cards randomly shuffled. Use the Random Class.
My Code:
private void shuffling()
    {
        Random generator = new Random();  
        int[] cards = new int[52];  
        for (int i=0; i<cards.length; i++) 
        {
            cards[i] = i;
        }
        for (int i=0; i<cards.length; i++) 
        {
            int randomPosition = generator.nextInt(cards.length);
            int temp = cards[i];
            cards[i] = cards[randomPosition];
            cards[randomPosition] = temp;
        }
    }
Problem: Am i following my teacher's instruction correctly for what she wants? And if i am, my problem is, how do i create a queue with the 52 cards randomly shuffled? i have the shuffling part down i think. Any help would be appreciated.
With regards,
A novice programmer
 
     
     
    