title: How to be sure UUID is not duplicated
body: <p>I'm working on a video share project and I would like to generate "characters" id's for each video similar to how youtube does it. for example <code>tgax-1sCgIs</code></p>
  
  <p>Is it safe to use the following function to generate UUIDs, If for example I've 100000000 videos and I need to add new uuid, how can I be sure it's not duplicated?</p>
  
  <pre><code>function generateRandomString($length = 11) {
      $characters = '0123456789abcdefghijklm-_nopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
      $randomString = '';
      for ($i = 0; $i &lt; $length; $i++) {
          $randomString .= $characters[rand(0, strlen($characters) - 1)];
      }
      return $randomString;
  }
  </code></pre>