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 int[] generateUnsortedArray(int length, int maxValue) {
        int[] array = new int[length];
        Random r = new Random();
        for (int i = 0; i < length; i++) {
            array[i] = r.nextInt(maxValue) + 1; // Avoid 0 value for better drawing
        }
        return array;
    }
}