Here you can find the source of shuffle(int arr[])
public static void shuffle(int arr[])
//package com.java2s; //License from project: LGPL import java.util.*; public class Main { private static Random r; public static void shuffle(int arr[]) { Random rnd = r;/* ww w . j a v a 2 s . com*/ if (rnd == null) { r = rnd = new Random(); } for (int i = arr.length; i > 1; i--) { int nextInt = rnd.nextInt(i); int tmp = arr[i - 1]; arr[i - 1] = arr[nextInt]; arr[nextInt] = tmp; } } }