Here you can find the source of shuffleIntArray(int[] arr)
public static void shuffleIntArray(int[] arr)
//package com.java2s; /*// w ww .j a va 2 s . c o m * Copyright (c) 2017, salesforce.com, inc. * All rights reserved. * Licensed under the BSD 3-Clause license. * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ import java.util.*; public class Main { private static Random rnd = new Random(); public static void shuffleIntArray(int[] arr) { if (arr == null || arr.length == 0) throw new IllegalArgumentException( "Array cannot be null or have zero length"); for (int i = arr.length - 1; i > 0; i--) { int index = rnd.nextInt(i + 1); int a = arr[index]; arr[index] = arr[i]; arr[i] = a; } } }