title: How to generate 8 character unique string without checking if it exist in the database
body: <p>I want to generate 1 million qr codes every day. every qr code should have <code>random unique value.</code> in order to achieve uniqueness i have two options as below</p>
  <p>1)First option is to generate 8 characters alphanumeric random string and check if it is exist in database. if not exist then store in the database and if exist then retry gain.</p>
  <p>The problem with this approach is that it takes around 45 minutes to generate 1 million unique alphanumeric strings because we have to check every time if generated alphanumeric string is present in the database or not.</p>
  <p>2)Second option is to generate unique token by appending 6 characters alphanumeric string with time(hour+minute+second+date+month+year). with this option i am able to generate 1 million unique alphanumeric string within 5 minutes.</p>
  <p>i am using this second option but the problem with this option is that the alphanumeric string generated from this is 15 characters long. i want to generate alphanumeric string with only 8 character long. if i use second option then timestamp itself takes 8 characters and string become easily guessable.</p>
  <p>I want to know how to generate 8 characters random and unique alphanumeric string without checking if it exist in the database or not.</p>