hello everyone I would like to create a random id with numbers and letters with a number of different characters! does anyone know how?
I am working this. i’ll have an answer shortly! I will create and share a demo app
DONE!
https://x.thunkable.com/copy/accd04e351511318a6cc4b9820e5713b
i am using the website Random.org (RANDOM.ORG - String Generator) - so that’s one holdup but…
they also offer a free and paid API for app/website developers
For numbers you can use the random integer between.
For a six digit number set the minimum number to 100000 and the largest number to 999999.
I had started with that, however, @Fernando_Matos asked for the addition of letters along with the numbers. This creates a much much higher availability of unique identifiers.
Either way, unless you are getting to 1,000,000 users, you shouldn’t have to worry if you just use the integer generator. Also, either way, if this is being implemented there should be a test to verify that the assigned unique identifier is not already in use. Random.org could be used to create a huge random non-repeating string list separated by commas which could be uploaded into your user database. Then each time a user signs up the app could get 1 and delete it from the list. That way you can ensure no 2 users get the same ‘random’ ID on accident.
thanks for the help, it looks interesting. but I would like to generate the codes with lowercase letters, numbers and special characters. and also with the number of digits the user prefers!
This explains how to generate a random string of characters:
I misread the original question!
You could make a list, each item in list is either a number from 0 to 9, a letter from a to z, and a special character. Make sense? Then you just pick a random item from list for the amount of characters the user selected.
This might work?
(edit)
Like this:
[0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,@,#,£,_,&,-,+,(,),/,*,",’,:,;,!,?,~,$]
I tried this way but I couldn’t make it work. I found an api that may help with my problem. I will test it in the next few days and will share the result.
https://x.thunkable.com/copy/11d7d22452ec736db948739e9d8ca86e
Seems to work fine for me?
Use input box to select amount of characters, then click button.
Here you go! I think this is exactly what you asked for in the first place @Fernando_Matos
https://x.thunkable.com/copy/64a8eae058a1b4b49b068caffed26479
Hello. thank you yes that’s right i’m going to put these blocks in my project and see if it works. a question. is it preferable to use an API or create this block scheme? thank you all
I think it just depends on what you want to do. if you have an api to use, that’s great. you’ just always need an internet connection and are at the mercy of the api providers server limits/uptime/etc. if you create the string natively, you don’t have to worry about anything as far as I know (with my limited knowledge).
I hope it works for you! If so, please click the solve button!
hello I replicated your blocks but the c special characters are not working
Did they combo work when you remixed my app?
yes
can you post a picture of your blocks or a share link? I could check this out sometime
try using this block
you will likely need to do this if you created the list with a text block and commas
the same