How to generate random number that hasn't already been generated?

Try to figure out how I can create an ID for something using Random (s) generator but my goal is to have it check and see if the number has already been generated in the database. So I don’t duplicate an ID. I am not sure how to do this!

Hey @1david2hot, you can use the Calculate Formula built-in function with Bubble, it should give you a unique one most of the time, but you can always have a condition check to see if the generated string already exists if it does make it regenerate another one.

How exactly would i do this? Still trying to figure this out!

You can log the generated number into a data type and then have a condition with a count looking up the newly generated number to see if it has been generated before. Depends on volume but could be rather slow. The second one is to allow collisions and for example you do the check when You insert a record into the table and if the number exists then then regenerate. The likelihood of collisions is low.