Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.Arrays;
import java.util.Random;

public class Main {
    public static int[] shuffle(int[] numbers) {
        for (int i = 0; i < numbers.length; i++) {
            int swap = new Random().nextInt(i + 1);
            int temp = numbers[swap];
            numbers[swap] = numbers[i];
            numbers[i] = temp;
        }
        return numbers;
    }

    public static void main(String[] args) {
        int[] i = shuffle(new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 });
        System.out.print(Arrays.toString(i));
    }
}