title: Efficiently generate a 16-character, alphanumeric string
body: <p>I'm looking for a very quick way to generate an alphanumeric unique id for a primary key in a table.</p>
  
  <p>Would something like this work?</p>
  
  <pre><code>def genKey():
      hash = hashlib.md5(RANDOM_NUMBER).digest().encode("base64")
      alnum_hash = re.sub(r'[^a-zA-Z0-9]', "", hash)
      return alnum_hash[:16]
  </code></pre>
  
  <p>What would be a good way to generate random numbers?
  If I base it on microtime, I have to account for the possibility of several calls of genKey() at the same time from different instances.</p>
  
  <p>Or is there a better way to do all this?</p>