Here you can find the source of shuffleArray(int[] ar, Random rnd, int mx)
public static void shuffleArray(int[] ar, Random rnd, int mx)
//package com.java2s; //License from project: LGPL import java.util.Random; public class Main { public static void shuffleArray(int[] ar, Random rnd, int mx) { for (int i = mx; i > 0; i--) { int index = rnd.nextInt(i + 1); // Simple swapArray int a = ar[index]; ar[index] = ar[i];/*from w w w . j av a2 s. c o m*/ ar[i] = a; } } public static void shuffleArray(int[] ar, Random rnd) { shuffleArray(ar, rnd, ar.length - 1); } }