If mt_rand() is run at the same moment, will the result be the same?
<p>I am writing a PHP script to handle file upload to server. To prevent overwriting when there are files with the same name, the program will rename each uploaded file to the current timestamp.</p>

<p>However, this is not enough. In peak hour, there may be files that are uploaded at the same second. To make sure the uploaded files will have different file names, I am thinking of adding a random number at the end of the timestamp.</p>

<p>Then, I read from <a href="http://php.net/manual/en/function.srand.php" rel="nofollow noreferrer">the official PHP page on srand()</a>    </p>

<blockquote>
  <p>Note: There is no need to seed the random number generator with
  srand() or mt_srand() as this is done automatically.</p>
</blockquote>

<p>I guess they are using the timestamp for <code>srand()</code>. If 2 files are uploaded at the same second, so the timestamp for <code>srand()</code>, will the random result be the same? If yes, is there a way I can make sure the name is not duplicated even if they are uploaded at the same second?</p>