Here you can find the source of shuffleArray(int[] arr)
public static void shuffleArray(int[] arr)
//package com.java2s; //License from project: Open Source License import java.util.Random; public class Main { public static void shuffleArray(int[] arr) { int n = arr.length; Random rnd = new Random(); for (int i = 0; i < n; i++) { int tmp = arr[i]; int randomPos = i + rnd.nextInt(n - i); arr[i] = arr[randomPos];/* w ww . j a v a 2 s.com*/ arr[randomPos] = tmp; } } }