Creating a 6 digit code and using it with text input

i need help to create a random 6 digit code, that not the same as other codes, users will enter this code in text input and its redirects to a website that the host will choose. i dont want to add so many cloud variables, so im asking here for a better way. if you dont understand, i want to create an app with 6 digit codes like kahoot, but its for a website redirect, not for a quiz.

1 Like

Hi @nmk

You can create a random 6 digit code like so:

Screen Shot 2564-10-30 at 15.22.55

Here is a demo link:

Is this what you are looking for?



You can generate it using @jakeheron advice.
On the other hand, if you want it to be unique, you need to compare new generate code with other codes already generated. For that you need to keep somehow those codes saved to have a list to compare with. As different users will access and generate codes, you can’t “escape” from keeping that list somehow in cloud.

1 Like

i know this code… i am searching for a way that people will not get the same code
but thanks

how about this:

you still need a list of previously generated values to check for preventing duplicates, though


Is your app already connected to Firebase or other cloud Database ? Because you need it for that purpose of unique code.

ty, i will try this


Then you just need a list variable stored in that cloud database.
After each generated code, add code to list, then before validate next code, just check the list.

how i can remove it automatically?

What will be the moment you won’t need current code anymore ?

Sorry for misinterpreting your question. However, next time, you should probably add your code you have made so far so people understand what you have already done. A link to the project would also be helpful.