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