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 {
    /**
     * Select a random number within a specified range.
     * @param min Lower limit.
     * @param max Upper limit.
     * @return int
     */
    public static int getRandomInteger(int min, int max) {
        Random r = new Random();
        return r.nextInt((max - min) + 1) + min;
    }
}