I am trying to generate 100 random permutations of an array and then store each of these random permutations within an ArrayList. Currently this isn't working I am able to generate one random permutation but the same one is stored 100 times
public void generatePermutations() {
int[] currentList = this.listOfItems;
int index, temp;
Random random = new Random();
for(int j = 0 ; j < 100; j++) {
for (int i = currentList.length - 1; i > 0; i--) {
index = random.nextInt(i + 1);
temp = currentList[index];
currentList[index] = currentList[i];
currentList[i] = temp;
}
permutationsList.add(currentList);
}
}
current output
[23, 45, 34, 53, 67, 99, 3, 0,13, 2, 12, 8] //the same permutation generated 100 times