title: A good algorithm for generating an order number
body: <p>As much as I like using GUIDs as the unique identifiers in my system, it is not very user-friendly for fields like an order number where a customer may have to repeat that to a customer service representative.</p>
  
  <p>What's a good algorithm to use to generate order number so that it is:</p>
  
  <ul>
  <li>Unique</li>
  <li>Not sequential (purely for optics)</li>
  <li>Numeric values only (so it can be easily read to a CSR over phone or keyed in)</li>
  <li>&lt; 10 digits</li>
  <li>Can be generated in the middle tier without doing a round trip to the database.</li>
  </ul>
  
  <p>UPDATE (12/05/2009)
  After carefully reviewing each of the answers posted, we decided to randomize a 9-digit number in the middle tier to be saved in the DB.  In the case of a collision, we'll regenerate a new number.</p>