/**
 * A class to test/use the Random number class
 */

public class RandomUse {

    /*******************************************************************************
     * main method to use/test the Random class
     *******************************************************************************/

    public static void main (String[ ] args)
    {           
    
        Random obj = new Random(0,5);           //create the random obj
        int num   = obj.getRand();              //generate the random num
        System.out.println(num);                //print the number

        Random obj2 = new Random(1,6);          //in 2 steps
        System.out.println(obj2.getRand());

        Random obj3;                            //create a var of type Random

        obj3 = new Random(11,16);               //use it
        System.out.println(obj3.getRand());

        obj3 = new Random(10,20);               //re-use the same obj3 object
        System.out.println(obj3.getRand());

        System.out.println( (new Random(-100,100)).getRand() );   //all in 1 step  


        obj3.minimum = -1000;                           //or, I can set the instance 
        obj3.maximum =  1000;                           //minimum and maximum values                        
        obj3.compute();                                 //and call the compute method directly
        System.out.println(obj3.getRand());


        System.out.println(obj.toString());
        System.out.println(obj2.toString());
        System.out.println(obj3);                       //no need to add .toString()
    }
}