Code snippet for random number generation and random characters selected from text

Dear SS Team,

Please assist with a code snippet on the scenario below:

I am designing a questionnaire for a laboratory sample form on the SS designer. I want my interviewers to label the blood sample tubes with a unique sample ID for every respondent. I would like to create a variable(X) which will store 2 random letters generated automatically from firstName and last name of the respondent as inputted by an interviewer.
In addition, I would like to generate numbers between 1 and 99 and concatenate it to the random characters selected from the persons’ names.
This final ID generated from the app will be written on the sample bottles.

For example:

Interviewer input a person names as after taken the lab sample as

Firstname(F): Mensah

Lastname(L): Kwesi

My syntax in the form design will do this on the tablet:

Step 1.generate random letters from (F) and (L) say ENKE

Step 2: generate a random number between 0 and 99, say, 7

step 3: Finally, Concatenate the values from step 1 & 2 to get: ENKE7. This final unique sample ID: ENKE7 will be written on the sample tube that will be sent to the lab for analysis.

  1. Your identification scheme does not guarantee non-overlap between IDs. What will you do with two (or three,…) identically marked blood samples?

  2. Suggest: change the order of events. Number the sample bottles first. When the sample is taken, the bottle number should be entered into the interview for that person in Survey Solutions. People also have used barcodes for that if they can be attached and easily read from the bottles. This is so standard that you can even purchase a pre-numbered batch of vials with attached barcodes, see for example (not a recommendation, just examples, warning external links):

thank you, Sergiy.
I will go for the option Numbering the bottles first. However, how do I ensure duplicate entry is not done by an interviewer for two different respondents?
For now, a pre-numbered batch of vials cannot be purchased within this short time to the start of the survey.