100) { print "Error: \"Length\" out of range (1-100)
\n"; return; } if (!$num && !$uc && !$lc) { print "Error: No character types specified
\n"; return; } $s=""; $i=0; do { switch(mt_rand(1,3)) { // get number - ASCII characters (0:48 through 9:57) case 1: if ($num==1) { $s .= chr(mt_rand(48,57)); $i++; } break; // get uppercase letter - ASCII characters (a:65 through z:90) case 2: if ($uc==1) { $s .= chr(mt_rand(65,90)); $i++; } break; // get lowercase letter - ASCII characters (A:97 through Z:122) case 3: if ($lc==1) { $s .= chr(mt_rand(97,122)); $i++; } break; } } while ($i<$len); return $s; } ?>