I currently have a randomly mixed ArrayList.
public static void main(String[] args) {
ArrayList<Integer> solution = new ArrayList<>();
for (int i = 1; i <= 48; i++) {
solution.add(i);
}
Collections.shuffle(solution);
This gives me a ArrayList with the numbers 1-48 randomly mixed. Now I have 4 arrays and I want to randomly add the elements of the ArrayList with out repetition.
int[] heartsRow = new int[14];
int[] diamondsRow = new int[14];
int[] spadesRow = new int[14];
int[] clubsRow = new int[14];
The reason the new arrays contain 14 elements is because the first two elements will always be the same.
heartsRow[0] = 1;
heartsRow[1] = 0;
diamondsRow[0] = 14;
diamondsRow[1] = 0;
spadesRow[0] = 27;
spadesRow[1] =0;
clubsRow[0] = 40;
clubsRow[1] = 0;
I want to completely fill each array with non-repeating elements of the ArrayList.