Classic Happy Relax Passionate Dreamless Halloween Photoshop Netscape DOS

Howto » ASP » Random Password Generator

This is an example of ASP code that generates a random password, however the same idea can be used for many other programming languages. Duplicates are possible but the odds are very low. When working with databases, you can always check if the same password already exists and assign another one if yes.


<%

   Dim pChar, pCount
   
 ' Here you can add other characters such as lowercase or special.
   pChar = "ABCDEFGHIJKLMNPQRSTUVWXYZ0123456789"
   
   pCount = Len(pChar) 
   
   Dim psw
   psw = ""
   
   Randomize
   For i = 1 To 8 ' password length
      psw = psw & Mid( pChar, 1 + Int(Rnd * pCount), 1 )
   Next
   
%>