Shuffling algorithm suitable? Just checking that this shuffling algorithm is suitable. Or maybe there could be improvements?

public static void shuffleArray(Object[] arr, Random rnd){
    int lastIndex = arr.length - 1;
    for (int i=0; i&lt;=lastIndex; i++){
        int k = nextInt(i,lastIndex+1, rnd);
        Object a = arr[i];
        Object b = arr[k];
        arr[i] = b;
        arr[k] = a;
    }
}

//Returns an integer between start(inclusive) and end(exclusive) [start..end) 
public static int nextInt ( int start, int end, Random rnd);
One small thing is during the last iteration of the loop, the last element is swapped with itself.

Why not just use the Collections.shuffle as a guide?

public static void shuffle(List&lt;?&gt; list, Random rnd) {
    int size = list.size();
    if (size &lt; SHUFFLE_THRESHOLD || list instanceof RandomAccess) {
        for (int i=size; i&gt;1; i--)
            swap(list, i-1, rnd.nextInt(i));
    } else {
        Object arr[] = list.toArray();

        // Shuffle array
        for (int i=size; i&gt;1; i--)
            swap(arr, i-1, rnd.nextInt(i));

        // Dump array back into list
        ListIterator it = list.listIterator();
        for (int i=0; i&lt;arr.length; i++) {
            it.next();
            it.set(arr[i]);
        }
    }
}

private static void swap(Object[] arr, int i, int j) {
    Object tmp = arr[i];
    arr[i] = arr[j];
    arr[j] = tmp;
}


This could be altered to:

public static void shuffleArray(Object[] arr, Random rnd) {
    for (int i=arr.length; i&gt;1; i--) {
        int j = rnd.nextInt(i);
        Object tmp = arr[i];
        arr[i] = arr[j];
        arr[j] = tmp;
    }
}