can someone show me with a video how to create a random number that is not repeated for the user id?
Hi @jevilson,
Interesting question. I decided to investigate and created a video for that:
Couple of comments:
- user email in Users collection is already checked on “uniqueness” in many places. So I prefer to use it as a unique ID;
- if you use random range which is large enough (say, 1-999 999 999 999), the probability of the same IDs will be very low. So may be it is not worthwhile to use timer, you just add a button to regenerate ID and name it somehow not to frighten the users. Anyway, the probability of getting 2 existing IDs in a row is close to 0.
Best regards, Victor.
There is a much easier way with no chance of creating the same ID twice.
- Create an ID column in the Users database.
- When clicking the sign up button, in the “Set Automatically” part, use the magic forumla and put users “COUNT”.
Now every user signed up will have a unique ID based on how many users there are 
ie the 3rd user in the table will be “3” / the 200th user in the table will be “200”
Hi @daniel,
As stated in the initial post, the ID should be random :))
Otherwise, your way works perfectly 
If you are going to use the suggestion from Victor, I would make one change to it:
Instead of ranging it from 1 to XXXXXX, you should range it from YYYYYY to XXXXXX. That way you are already starting on a number with 6 digits. So the chance of getting the same number twice is MUCH lower than if starting from a single digit.
thank you very much, helped me with my project
Hi, is there also a way of generating random usernames, e.g. a random sequence of letters? Thanks in advance!
You can use the random.org API to do this.
