title: JAVA - How to generate Random number between 2 integers?
body: <p>i'm trying to read in two integer numbers from the console and then display a random integer number generated between these two numbers.</p>
  
  <p>this is my code.</p>
  
  <pre><code>import java.awt.*;
  import java.io.*;
  import java.util.*;
  import java.math.*;
  
  public class Question8{
  
      public static void main(String[] args)
      {
          int first, second;
  
          Scanner myScanner = new Scanner(System.in);
  
          System.out.println("Enter first integer: ");
          int numOne;
          numOne = myScanner.nextInt();
          System.out.println("You have keyed in " + numOne);
  
          System.out.println("Enter second integer: ");
          int numTwo;
          numTwo = myScanner.nextInt();
          System.out.println("You have keyed in " + numTwo);
  
          Random generator = new Random();
          //int num = generator.nextInt(numOne) + numTwo;
          System.out.println("Random number: " + numOne + generator.nextInt(numTwo - numOne));
      }
  }
  </code></pre>
  
  <p>after i execute this program..
  i do not get the random number that's between the 2 integers.</p>
  
  <p>this is my output:</p>
  
  <pre><code>Enter first integer: 
  20
  You have keyed in 20
  Enter second integer: 
  30
  You have keyed in 30
  Random number: 204
  </code></pre>
  
  <p>hope you guys can help me in any way you can (:</p>