Hey, I am making a small function that will be used within a database application and it should generate a random 5 digit number, however if the number already exists within a text file then it will create another number instead so you never get the same number twice. At the moment the program won't regenerate the number if its already been generated and I can't figure out why. ; Generates a random 5 digit Customer ID with 100,000 possible combinations. ; Declare Variables $IDLength