Here you can find the source of shuffle(Object[] a, Random r)
public static void shuffle(Object[] a, Random r)
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { /**//from www. ja va 2 s .c om * shuffle array */ public static void shuffle(Object[] a, Random r) { for (int n = 0; n < a.length; n++) { // don't just pick random position! int x = r.nextInt(a.length - n) + n; Object o = a[n]; a[n] = a[x]; a[x] = o; } } }