fisher yates shuffle jAVA code example
Example: how to write a perfect shuffle method in java
public static int[] RandomizeArray(int a, int b){
Random rgen = new Random(); // Random number generator
int size = b-a+1;
int[] array = new int[size];
for(int i=0; i< size; i++){
array[i] = a+i;
}
for (int i=0; i<array.length; i++) {
int randomPosition = rgen.nextInt(array.length);
int temp = array[i];
array[i] = array[randomPosition];
array[randomPosition] = temp;
}
for(int s: array)
System.out.println(s);
return array;
}