Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Password generator
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00533282
Message ID:
00533299
Views:
32
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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform