title: Random numbers in Java when working with Android
body: <p>I need to make a random number between 1 and 20, and based on that number (using "If - Then" statements), I need to set the image of an ImageView.</p>
  
  <p>I know that in Objective-C, it goes like this:</p>
  
  <pre><code>int aNumber = arc4Random() % 20;
  if (aNumber == 1) {
      [theImageView setImage:theImage];
  }
  </code></pre>
  
  <p>How can I do this in Java? I have seen it done this way, but I do not see how I can set the range of numbers (1-20, 2-7, ect).</p>
  
  <pre><code>int aNumber = (int) Math.random()
  </code></pre>