Since I did not get a satisfactory answer here (and I really needed to get it going on this weekend), I decided to implement my own Fisher–Yates shuffle, porting the code I found in other SO posts. I know my programming technique is far from optimal, so I decided to post this here.
What do you think? Can it be improved?
public static JSONArray shuffleJsonArray (JSONArray array) throws JSONException {
// Implementing Fisher–Yates shuffle
Random rnd = new Random();
for (int i = array.length() - 1; i >= 0; i--)
{
int j = rnd.nextInt(i + 1);
// Simple swap
Object object = array.get(j);
array.put(j, array.get(i));
array.put(i, object);
}
return array;
}