Here you can find the source of shuffleArray(int[] ar)
public static void shuffleArray(int[] ar)
//package com.java2s; /*/*from w ww . j a v a 2s. com*/ * Copyright (C) ${year} Omry Yadan <${email}> * All rights reserved. * * See https://github.com/omry/banana/blob/master/BSD-LICENSE for licensing information */ import java.util.*; public class Main { public static void shuffleArray(int[] ar) { Random rnd = new Random(); for (int i = ar.length - 1; i >= 0; i--) { int index = rnd.nextInt(i + 1); // Simple swap int a = ar[index]; ar[index] = ar[i]; ar[i] = a; } } }