title: How to make purely random generation of numbers in certain interval
body: <p>I have an generation method that generates numbers between 1 and 8. But the problem is that this method often generates the numbers 1-7 and almost never number 8. My question is that how to generate random numbers in certain interval but that all numbers appear approximately same times ?</p>
  
  <p>EDIT:</p>
  
  <p>my number generator</p>
  
  <pre><code>public int generateNumber() {
      Random r = new Random();
      return r.nextInt(8 - 1) + 1;
  
  }
  </code></pre>