title: Generate unique ID
body: <p>I need to generate unique ID's for my application. When I used <code>(UUID.randomUUID()).toString()</code>, I am getting a code (thinking this will be unique), which is very lengthy.</p>
  
  <p>I am not sure how unique it will be, when we generate codes with the help of Java Timestamp or randomstring.</p>
  
  <p>I need to generate unique codes which is only of <strong>8-10 characters in length</strong> (alpha-numeric). How to get so? 
  I am using MySQL database. </p>
  
  <p>Is generating unique code on database side is the best way or can we generate such short (but unique) codes in Java?</p>
  
  <p>Any suggestions with example code will be very helpful.</p>