title: How Can I Generate Random Unqiue Numbers in C#
body: <pre><code>public int GenPurchaseOrderNum()
  {
      Random random = new Random();
      _uniqueNum = random.Next(13287, 21439);
      return UniqueNum;
  }
  </code></pre>
  
  <p>I removed unique constraint from the PONumber column in the db because an employee
  should only generate P.O. # when the deal is set. Otherwise, P.O. # would have 0.</p>
  
  <p>P.O. Number used to have unique constraint, this forces employee to generate P.O. in all cases so the db doesn't throw unique constraint error.</p>
  
  <p>Since i removed the unique constraint, any quote doesn't have P.O. will carry 0 value. Otherwise, a unique value is generated for P.O. #. However, i don't have a unique constraint in db which makes it hard for me to know whether the application generated P.O. # is unique or not.</p>
  
  <p>What should i do?</p>
  
  <p>I hope my question is clear enough</p>