title: Random nextInt() not working fine, better way to get random numbers?
body: <p>I need to get a random number between two integers. I'm using this function to get it:</p>
  
  <pre><code>     public int randInt(int min, int max) {
          Random rand = new Random();
          int randomNum = rand.nextInt((max - min) + 1) + min;
          return randomNum;
       }
  </code></pre>
  
  <p>The problem is that sometimes the function is not working fine, because it is giving me chains of numbers with very low difference, for example, i'm calling the function with min 0 and max 1000, and sometimes i get these values in a chain: 500, 500, 502, 500, 500, 500, 520, 530, 503, 500, 500, 501 etc...</p>
  
  <p>Sometimes the function works fine, and i get values with a lot of difference, for example, 1, 20, 500, 200, 444, 850, 664, etc...</p>
  
  <p>So... i need a function that returns real random numbers allways, and not sometimes...</p>
  
  <p>There is a better way to achieve this? with a min and max values for the random?</p>
  
  <p>thanks</p>