title: Looping with a random number generator in Java
body: <p>I have a random number generator here that picks a number from 1 - 50.</p>
  
  <p>What I want it to do is pick a second random number from 1-50, that will <em>only</em> print to the console if it is greater than the previous random number, and repeat a number of times, let's say 10 times.</p>
  
  <p>My teacher wants me to use only the Math.floor(Math.random() method to generate a number so I have to work with that.</p>
  
  <p>I'm not sure how to compare the latest generated number to the previous generated number.</p>
  
  <p>What I got so far is</p>
  
  <pre><code>int myRand = 10;
      while (myRand &gt; 0) {
          int myRand2 = (int) (Math.floor(Math.random() * 50) + 1);
          System.out.println(myRand2);
          System.out.println();
          myRand--;
  </code></pre>
  
  <p>Where would the second part that would compare that first generated number to subsequent generated numbers go? </p>