Here you can find the source of shuffle(int[] a)
public static void shuffle(int[] a)
//package com.java2s; //License from project: Apache License import java.util.Random; public class Main { static final Random rand = new Random(); public static void shuffle(int[] a) { // Fischer-Yates shuffle for (int i = a.length - 1; i > 0; i--) { int j = rand.nextInt(i + 1); swap(a, i, j);//from ww w . j a v a2 s . co m } } public static void swap(int[] a, int i, int j) { int temp = a[i]; a[i] = a[j]; a[j] = temp; } }