How do I generate a 6 digit random number?

I intend to generate a '6 ’ character unique ID for each of my respondents.
Which of these random number functions would be the most effective to do the job, interms of performance.

1, once(random())*1000000
2. substr((today()*now()*random()*100),0,6)

Any one with a useful formula to carrying out this task using random function would be appreciated!..

Thank you

@chiabotu, did you mean you wish to provide a unique id (number) to each submissions submitted to the server?

@Kal_Lam , yes! using a random functions. for just 6digits numbers

I dont want to use this formular:
concat(substr(today(), 0, 4), substr(today(), 7, 5), substr(today(), 10, 8), substr(now(), 13, 11), substr(now(), 16, 14), substr(now(), 19, 17))

It works best in Enketo webform.
I need formula that goes fine in kobocollect.

The rand function i stated above ;which one of them works with no repeats?

Thank you

@chiabotu, maybe try this as outlined in the image shared below:

In the survey tab of your XLSForm:

image

Data entry screen as seen in Enkekto:

image

Reference XLSForm:

Random Number (6 digits).xlsx (10.2 KB)

1 Like