title: Unique random number for a particular timestamp
body: <p>I am kind of learning concepts of Random number generation &amp; Multithreading in java. </p>
  
  <p>The idea is to not generating a repeated random number of range 1000 in a particular millisecond (Considering, not more than 50 data, in a multithreaded way will be processed in a millisecond). So that list of generated random number at the specific time is unique. Can you give me any idea as i am ending up generating couple of repeated random numbers (also, there is a considerable probability) in a particular milli second. </p>
  
  <p>I have tried the following things where i failed. </p>
  
  <pre><code>Random random = new Random(System.nanoTime());
  double randomNum = random.nextInt(999);
  </code></pre>
  
  <p>//</p>
  
  <pre><code>int min=1; int max=999;
  double randomId = (int)Math.abs(math.Random()* (max - min + 1) + min);
  </code></pre>
  
  <p>//</p>
  
  <pre><code>Random random = new Random(System.nanoTime()); // also tried new Random();
  double randomId = (int)Math.abs(random.nextDouble()* (max - min + 1) + min);
  </code></pre>
  
  <p>As I am appending the timestamp that is being generated, in a multithreaded environment i see the same ids (around 8-10) that is being generated (2-4 times) for 5000+ unique data. </p>