I have to shuffle a deck (array) of 52 integers but I started with 3 for testing if it was an even shuffle and it will place the same integer in more than one spot in the random array. I'm not sure what I'm doing wrong.
import java.util.Random; public class shuffleDeck { public static void main(String[] args) { int[] Deck = new int[3]; for (int i=0; i<3; i++) { Deck[i] = i; } Random r = new Random(); int[] RandomDeck = new int[3]; for (int i=0; i<3; i++) { int randomPosition = r.nextInt(3); RandomDeck[randomPosition] = Deck[i]; } System.out.println("Original Deck \t Random Deck"); for (int i=0; i<3; i++) { System.out.println(Deck[i] + "\t\t " + RandomDeck[i]); } } }