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 getRandomNumber(int max) {
        if (max <= 0)
            return 0;
        int random = (int) (Math.random() * max + 1);
        return random;
    }

    public static double getRandomNumber(double start, double end) {
        double random = new Random().nextDouble();
        double result = start + (random * (end - start));
        return result;
    }
}