Actually in my php application i want to assign every user a unique number code. For that i am using mt_rand(0,100000000). I want it to generate millions of number for say millions of different users without repeats and save it to database. Is it possible ? Or any other technique is recommended ?
Also to make sure the number doesn't repeat I am checking if the number already exists in the db through php, if it does exist i reload the page to generate another number and save it to db orelse continue to save the number as it is.
Is it the best pratice ?
I am new to this non repeating number generator in php so don't know the efficient method.