Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Password generator
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00533282
Message ID:
00533299
Vues:
33
This message has been marked as the solution to the initial question of the thread.
>Hello,
> Before I get into this, thought I'd check to see if anyone has a routine they are willing to share, or even some ideas on what I can do to create one, that generates random passwords. The only criteria is that the passwords are 6 characters long, the first character is an alpha character, and it is all lower case. Thanks a lot,

FUNCTION GeneratePwd
LPARAMETERS pnLen    && Length of Password - in your case 6

rand(-1)
LOCAL lcPwd, lnRnd, lnCnt

lcPwd = ""
FOR lnCnt = 1 TO pnLen
	IF lnCnt = 1 OR mod(int(rand() * 100), 2) = 0 then
		lnRnd = int(rand() * 25) + 97
	ELSE
		lnRnd = int(rand() * 9) + 48	
	ENDIF
	lcPwd = lcPwd + chr(lnRnd)
ENDFOR

RETURN lcPwd
ENDFUNC
HTH,
- Erik Niese-Petersen

Crazy Dane in USA.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform