/**
 * A proper way to create a class (without the main method)
 *
 * Create a random number generator class
 * Create objects of that class by passing minimum and maximum values
 * call the getRand() method to get the random number
 *
 */

public class Random
{
    int    minimum;                         //instance fields
    int    maximum;                 
    double randGenerated;                       
    int    rand;                        


    Random(int min, int max)                //constructor that takes min, max       
    {
        minimum = min;
        maximum = max;

        compute();                                              //call compute method
    }

    void compute()                           //method to generate the random number                          
    {
        randGenerated = Math.random();

        rand = (int) (randGenerated * (maximum-minimum+1) );    //random distribution over max-min
        rand = rand + minimum;                                  //add the minimum value
    }

    int getRand()                           //getter method to return the random number generated                         
    {
        return(rand);
    }

    public String toString()                //method that returns everything        
    {
        String s = "Random number from: "  +  minimum  + " to: " + maximum + "\n" + 
                   "raw: " + randGenerated + " is--> " + rand;            
        return(s);
    }
}