Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Auto-generate password with certain criteria 1

Status
Not open for further replies.

foxup

Programmer
Dec 14, 2010
328
CA
Hi,

I'm wondering if anybody can help me. I'm looking to have a .PRG "auto-generate" and password with the following criteria:

- 8 alphanumeric characters in length total
- all lowercase
- first 3 characters are letters, next 2 are numbers, next 3 are letters
- excluding the following 4 letters "o", "l", "q", "g"
- excluding the following 2 numbers "0", "1"
- no spaces

can anybody help please?

Thanks,
J

 
Perhaps something like:

Code:
str1='abcdefhijkmnprstuwvxyz'
str2='23456789'
=RAND(-1)

result=;
SUBSTR(str1,INT(rand()*22+1),1)+;
SUBSTR(str1,INT(rand()*22+1),1)+;
SUBSTR(str1,INT(rand()*22+1),1)+;
SUBSTR(str2,INT(rand()*8+1),1)+;
SUBSTR(str2,INT(rand()*8+1),1)+;
SUBSTR(str1,INT(rand()*22+1),1)+;
SUBSTR(str1,INT(rand()*22+1),1)+;
SUBSTR(str1,INT(rand()*22+1),1)

RETURN result

 
Beauty! Thanks JactheC

Nice one!

Thank you,
FOXUP!
 
Nevermid. My err. Your code works perfectly JackTheC.

Thanks again! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top