Generating a unique user ID

hello everyone ,i am generating survey form,they survey is conduct in two state simultaniously how i generate unique user id which is combination of state code 1st two initial and auto generate four digit no

What is your workflow and how will you be using the unique ID? Different scenarios are described here:

Can you generate the unique IDs after the data is submitted? If you are collecting data across multiple devices it is not possible to coordinate the increase of a four digit number.