title: How does Amazon generate its order number?
body: <p>Note: I have already read through older questions like <a href="https://stackoverflow.com/questions/178572/what-is-the-best-format-for-a-customer-number-order-number">What is the best format for a customer number, order number?</a> , however my question is a little more specific.</p>
  
  <p>Generating pseudo-random numbers encounter the "birthday problem" before long. For example, if I am using a 27-bit field for my order number, after 15000 entries, the chances of collision increase to 50%.</p>
  
  <p>I am wondering whether large ecommerce businesses like Amazon generates its order number in any other way - for example :</p>
  
  <ul>
  <li>pre-generate the entire set and pick from them randomly (a few hundred GB of database)</li>
  <li>Use lexicographical "next_permutation" starting from a particular seed number</li>
  <li>MD5 or SHA-1 hash of the date, user-id, etc parameters, truncated to 14 digits</li>
  <li>etc</li>
  </ul>
  
  <p>All I want is a non-repeating integer (doesnt need to be very random except to obfuscate total number of orders) of a certain width. Any ideas on how this can be achieved ?</p>