i am creating a a form where in patients are registered and given a unique ID number(serial numbers) . and i need generate a pin number along with this id for him . which is the best way to generate a pin numbers for users (like that of credit cards). so that its unique for each patients.
generate pin numbers for patients
Collapse
X
-
Tags: None
-
due to not knowing about the constraints of the PIN, I can only tell that you need a random number generator, by which you can fetch a character out of the set of valid characters. then you have to save all PINs, so that you don’t hand out a PIN twice (improbable, but not impossible). -
yeah that was ma problem i have !! random number generator should not give same number twice, which is most probable of happening.Comment
-
i know random number generator is gud method for uniqueness but wht if 2 users get the same number ! its not accepted na!!Comment
-
-
You might like to check uniqid() function; it claims to generate unique strings. If you need to put the patients to some categories, the first argument might come in handy (it is a string that is attached to start of the id).Comment
Comment