generate pin numbers for patients

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pradeepjain
    Contributor
    • Jul 2007
    • 563

    generate pin numbers for patients

    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.
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    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).

    Comment

    • pradeepjain
      Contributor
      • Jul 2007
      • 563

      #3
      yeah that was ma problem i have !! random number generator should not give same number twice, which is most probable of happening.

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        I happily use a database for storing my PINs. (OK, it’s an email unsubscribing system…)

        Comment

        • pradeepjain
          Contributor
          • Jul 2007
          • 563

          #5
          i know random number generator is gud method for uniqueness but wht if 2 users get the same number ! its not accepted na!!

          Comment

          • Dormilich
            Recognized Expert Expert
            • Aug 2008
            • 8694

            #6
            I already told you, that you have to check your newly created PIN against all previously generated PINs…

            Comment

            • pradeepjain
              Contributor
              • Jul 2007
              • 563

              #7
              okie!! sorry i did not make out from the last reply !!

              Comment

              • artov
                New Member
                • Jul 2008
                • 40

                #8
                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).
                Last edited by Dormilich; Dec 21 '09, 10:45 AM. Reason: corrected function name

                Comment

                • Dormilich
                  Recognized Expert Expert
                  • Aug 2008
                  • 8694

                  #9
                  it claims to generate unique strings.
                  at least if the final PIN string is not too short. however, it makes duplicate values only much less probable (although that is tending towards zero).

                  Comment

                  Working...