Is there any way to generate 5 digit numeric unique ID?

Is there any way to generate 5 digit numeric unique ID? I tried dice roll as well, but it’s just not generating 5 digit number.

I am sure javascript might solve the problem :slight_smile:

Question: are you 100% certain that you will never have more than 10,000 rows? Because if you will, then it’s impossible to have a 5 digit unique numeric ID.

Rolling dice, will genarate a random number, not unique

1 Like

I have another column that will be merged with this one to make a unique id.

So how can we achieve it? :grin:

Every time you add the row, increment id number… And if you wanna make this id look big and complicated… Then add to it the random number ; -)

No way to do through Java script? :frowning:

Ensuring that 5 digits are always unique is tough to do without keeping track of every combination that has already been used. Imagine flipping a coin. Twice it will be unique, then every other time it will be a duplicate.

To get a unique value, you need several seed values. I believe that a typical UUID/GUID uses several factors, such as date, time, machine id, and probably other things to guarantee that it’s astronomically impossible to generate the same value twice. Only asking for 5 numeric digits gives you a finite chance of generating a number that is unique, and it gets exponentially harder and harder to get a number that hasn’t been generated before.

My best advice is to somehow track numbers that have already been assigned. Maybe a comma delimited list, then pass that into a javascript column with some code that returns a new number that doesn’t conflict with the commas delimited list. It won’t solve race conditions if multiple users are generating unique IDs rapidly at the same time.

Another thought is to do something with parsing out date and time to get a numeric value with possibly a value unique to the user, but you aren’t going to fit that in 5 numeric digits.

The trick is to find a way to generate a number that is impossible to regenerate ever again. With 5 numeric digits, you only have 100,000 possible combinations which isn’t much compared to the 5,316,911,983,139,663,491,615,228,241,121,400,000 possible combinations of a GUID/UUID and a smaller but still massive number of combinations for Row ID.


Yes, you can use JavaScript for that… what exactly do you want to achieve?