Here you can find the source of shuffleArray(Object[] array)
public static void shuffleArray(Object[] array)
//package com.java2s; //License from project: Open Source License import java.util.Random; public class Main { public static void shuffleArray(Object[] array, Random random) { for (int i = array.length - 1; i > 0; i--) { int index = random.nextInt(i + 1); Object obj = array[index]; array[index] = array[i];//from w ww. jav a2 s .c om array[i] = obj; } } public static void shuffleArray(int[] array, Random random) { for (int i = array.length - 1; i > 0; i--) { int index = random.nextInt(i + 1); int obj = array[index]; array[index] = array[i]; array[i] = obj; } } public static void shuffleArray(Object[] array) { shuffleArray(array, new Random()); } }