Java tutorial
//package com.java2s; // under the BSD license. The original license terms are given below: import java.util.Random; public class Main { /** * Shuffle an array. * @param array Array. */ private static void Shuffle(double[] array) { Random random = new Random(); for (int i = array.length - 1; i > 0; i--) { int index = random.nextInt(i + 1); double temp = array[index]; array[index] = array[i]; array[i] = temp; } } /** * Shuffle an array. * @param array Array. */ private static void Shuffle(int[] array) { Random random = new Random(); for (int i = array.length - 1; i > 0; i--) { int index = random.nextInt(i + 1); int temp = array[index]; array[index] = array[i]; array[i] = temp; } } /** * Shuffle an array. * @param array Array. */ private static void Shuffle(float[] array) { Random random = new Random(); for (int i = array.length - 1; i > 0; i--) { int index = random.nextInt(i + 1); float temp = array[index]; array[index] = array[i]; array[i] = temp; } } }