Monday, November 08, 2010 at 12:05 AM.
system.verbs.builtins.string.getRandomPassword
on getRandomPassword (ct, flAllLower=true) {
<<Changes
<<7/29/10; 12:34:36 AM by DW
<<Add optional parameter, flAllLower, default true. Makes it easier when typing the password.
<<1/11/06; 4:41:38 AM by DW
<<Only generate alpha and numeric chars.
<<Mon, Apr 27, 1998 at 11:00:10 AM by PBS
<<Generate a random password ct long.
local (s= "", ch);
while sizeof (s) < ct {
ch = random (33, 122);
if string.isalpha (ch) or string.isnumeric (ch) {
s = s + char (ch)}};
if flAllLower { //7/29/10 by DW
s = string.lower (s)};
return (s)}
<<bundle //test code
<<dialog.alert (getrandompassword (10))
This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.