title: Generate random number between 0000 and 9999
body: <p>I need to generate a 4 digit number from 0000 to 9999 and I can't seem to do so. I have this code, but it will generate 762 sometime, and I can't let it do that. I do need to use these methods though to generate it. </p>
  
  <pre><code>private java.util.Random rndGenerator = new java.util.Random();
  private int randomValue;
  public final static int NUMBER_OF_VALUES = 9999;
  
  
  public GuessRandomValue() {
      randomValue = rndGenerator.nextInt(NUMBER_OF_VALUES);
  }
  
  
  public void setAnswer() {
      randomValue = rndGenerator.nextInt(NUMBER_OF_VALUES);
  }  
  </code></pre>