Here you can find the source of shuffle(T[] array, Random random)
public static <T> void shuffle(T[] array, Random random)
//package com.java2s; //License from project: Apache License import java.util.Random; public class Main { public static <T> void shuffle(T[] array, Random random) { int count; if (array != null && (count = array.length) > 1) { for (int index = count - 1; index > 0; --index) { int newIndex = random.nextInt(index + 1); T temp = array[index];/*w ww . j a v a2 s . c o m*/ array[index] = array[newIndex]; array[newIndex] = temp; } } } public static void shuffle(double[] array, Random random) { int count; if (array != null && (count = array.length) > 1) { for (int index = count - 1; index > 0; --index) { int newIndex = random.nextInt(index + 1); double temp = array[index]; array[index] = array[newIndex]; array[newIndex] = temp; } } } public static void shuffle(int[] array, Random random) { int count; if (array != null && (count = array.length) > 1) { for (int index = count - 1; index > 0; --index) { int newIndex = random.nextInt(index + 1); int temp = array[index]; array[index] = array[newIndex]; array[newIndex] = temp; } } } public static void shuffle(long[] array, Random random) { int count; if (array != null && (count = array.length) > 1) { for (int index = count - 1; index > 0; --index) { int newIndex = random.nextInt(index + 1); long temp = array[index]; array[index] = array[newIndex]; array[newIndex] = temp; } } } }