Generate random 10-character alphanumeric code

3

I currently have an application that is displaying data divergence because of the return time of a webservice.

To get around this we have created a code to prevent this information from ever being repeated until everything is working.

I need to generate a 10 digit ID code, which is not repeated on other tablets that use my application. Because it can compromise the data in the system.

How can I generate a 10 digit random alphanumeric code and not repeat this code using Java?

    
asked by anonymous 28.10.2014 / 14:39

1 answer

8

You can use UUID and leave 2 digits for you to increment each operation so you never repeat. Leave an available length , which you believe will not pop.

Another possibility is to use a fixed number of each device and the seconds of the day that you are using in alphanumeric, for example, 00:02 in the morning of the 120seg 003c in the 4 digit case.

    
28.10.2014 / 14:55