Math.random prints out 10 random integers but they are all the same number?
<p>In the following program the use is asked which range of number he would like to generate 10 random numbers from, however, once the user inputs his choice the numbers printed are all the same?</p>

<pre><code>import java.io.*;

public class RandomInt
{
    public static void main (String [] args) throws IOException
    {
        String inGuess;
        int theGuessInt = 0;
        int theNum;
        int theNum2;
        BufferedReader myInput = new BufferedReader (new InputStreamReader (
                System.in));
        System.out
                .println ("Hello this program generates random numbers from 0-10 or 20-30");
        System.out
                .println ("Please input '1' for the random generation of 0-10, or '2' for the generation of 20-30");
        inGuess = myInput.readLine ();
        theGuessInt = Integer.parseInt (inGuess);
        // Generate random numbers from 0 to 10
        theNum = (int) (Math.random () * 10 - 0) + 0;
        // Generate random numbers from 20 to 30
        theNum2 = (int) (Math.random () * 30 - 20) + 20;
        if (theGuessInt == 1)
        {
            System.out
                    .println (" You chose to generate ten random numbers from 0-10");
            System.out.println (" Please wait....(Press any key to con't)");
            inGuess = myInput.readLine ();
            System.out.println (theNum);
            System.out.println (theNum);
            System.out.println (theNum);
            System.out.println (theNum);
            System.out.println (theNum);
            System.out.println (theNum);
            System.out.println (theNum);
            System.out.println (theNum);
            System.out.println (theNum);
            System.out.println (theNum);
        }
        if (theGuessInt == 2)
        {
            System.out
                    .println (" You chose to generate ten random numbers from 20-30");
            System.out.println (" Please wait....(Press any key to con't)");
            inGuess = myInput.readLine ();
            System.out.println (theNum2);
            System.out.println (theNum2);
            System.out.println (theNum2);
            System.out.println (theNum2);
            System.out.println (theNum2);
            System.out.println (theNum2);
            System.out.println (theNum2);
            System.out.println (theNum2);
            System.out.println (theNum2);
            System.out.println (theNum2);
        }
    }
}
</code></pre>
