hello,
I want to generate random password for first time use when registration is completed. How to genereate random string/integeer or combination of both in VBScript>?
thanks
chris
Printable View
hello,
I want to generate random password for first time use when registration is completed. How to genereate random string/integeer or combination of both in VBScript>?
thanks
chris
The following code will produce a strpassword containing 10 alphanumeric characters.
dim rndnum as integer, rndsel as integer, rndchr as integer
dim strpassword as string
strpassword = ""
for i = 1 to 10
rndnum = int(rnd * 10) + 48
rndchr = int(rnd * 26) + 65
rndsel = int(rnd * 2)
strPassword = strpassword & chr$(iif(rndsel = 0, rndnum, rndchr))
next
this is for VB, i need it inside my ASP page...i cannot use the iif function in VBScript...
thanks anyway =)
anymore help plz!!
chris
then declare a variable chrtouse
if rndsel = 0 then
chrtouse = chr$(rndnum)
else
chrtouse = chr$(rndchr)
endif
strpassword = strpassword & chrtouse
instead of
strpassword = strpassword & chr$(iif(...))
well..it does generate random number...but when another user register, it'll generate exactly the same password....and we dun want that to happen...
chris
hi, thanks a lot man for your help! =)
i've solved the problem...i just put "Randomize" at the beginning of each loop...that would do...
thanks!!
chris