Er. Arjun saini Er. Arjun saini - 4 months ago 8
Android Question

How to create Random number with 5 digit combined of number and charter

I want to generate the random number like that


  • ADF1845CFT

  • ADF1864ATY

  • ADF18AT65Y




Note: There I FIX the ADF18 I want only take the next 5 digit with number and charter


I am successfully create the 5 digit with number

There is Various solution I am using



etc. method

With these method I am create successful random 5 digit numbers.

Any Help Appreciate....

Answer

you can use random UUIDs...

Example:

final String randomCode = UUID.randomUUID().toString();
// or you can play with the len...
final String randomCode2 = UUID.randomUUID().toString().substring(0, 5);
Comments