/**
 * A good way to create a method    
 *
 * Create a random number generator method
 * Pass it a minimum and a maximum value
 * Get back a random number between those values
 *
 */

public class Rand1
{
    /**
     * main method 
     */

    public static void main (String[ ] args)
    {        
        int num;

        num = genRandom(0,5);               //random number from 0 to 5
        System.out.println(num);

        num = genRandom(1,6);               //random number from 1 to 6
        System.out.println(num);

        num = genRandom(11,16);             //random number from 11 to 16
        System.out.println(num);

        num = genRandom(10,20);             //random number from 10 to 20
        System.out.println(num);

        num = genRandom(-10,10);            //random number from -10 to 10
        System.out.println(num);
    }


    /**
     * A random number generator method
     *
     * @param  min   - type int - random number minimum value
     * @param  max   - type int - random number maximum value
     * @return rand  - type int - the generator random number
     */

    static int genRandom(int min, int max)              //generate random num between min-max       
    {
        int rand;                                       //create a local variable
        rand = (int) (Math.random( ) * (max-min+1) );   //random distribution over max-min
        rand = rand + min;                              //add the minimum value
        return (rand);                                  //return the random number
    }
}