title: Random numbers in C++ vs Java
body: <p>I have been using this in Java and I know what it produces: </p>
  
  <pre><code>Random r = new Random(); 
  double mynum = r.nextDouble();
  </code></pre>
  
  <p>Whereas, I found this code in C++ which I wanted to use in Java: </p>
  
  <pre><code>srand(time(NULL));
  double mynum = (double)rand() / RAND_MAX; 
  </code></pre>
  
  <p>Are these both equal? </p>
  
  <p>If no, then what would be the equivalent java code? </p>
  
  <p>where equivalent means produce a similar sequence of numbers? And my scientific computation will not be affected by this conversion of code from C++ to Java.</p>
  
  <p>I was assuming both as the same thing, not sure...</p>