Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Random;

public class Main {
    public static void random(int[] input) {

        for (int i = 0; i < input.length - 1; i++) {
            int randomIndex = new Random().nextInt(input.length - 1);
            int temp = input[randomIndex];
            // swap numbers
            input[randomIndex] = input[input.length - 1 - i];
            input[input.length - 1 - i] = temp;
        }
    }
}