title: Error with min and max values random generator java
body: <p>When I enter the minimum and maximum value it shows a value outside these bounderies. Why is this? For example:</p>
  
  <pre><code>Enter minimum value: 20
  Enter maximum value: 40
  Your number is: 50
  </code></pre>
  
  <p>There is other code as well, but that all works fine. Here is the method below which does not work:</p>
  
  <pre><code>public void randomNumberMinMax(){
  
      int min;
      int max;
  
      System.out.print("Enter minimum value: ");
      min = myScan.nextInt();
  
      System.out.print("Enter maximum value: ");
      max = myScan.nextInt();
  
      int i = (int)(Math.random() * max) + min;
      System.out.println("Your number is: " + i);
      if (i &lt; min || i &gt;= max);
  }   
  
  public static void main(String[] args) {
      RandomNumberGenerator generator = new RandomNumberGenerator();
      generator.randomNumberMinMax();
  </code></pre>