add method makeRandomString()

This commit is contained in:
Uwe Steinmann 2025-10-20 12:42:31 +02:00
parent 917ba91d95
commit 3782e71ae6

View File

@ -1293,6 +1293,20 @@ class SeedDMS_Utils { /* {{{ */
} }
} /* }}} */ } /* }}} */
/**
* Create a random string
*
* @param integer $n number of chars
* @param string $alph alphabet used as source for chars
* @return string random string
*/
static public function makeRandomString($n, $alph = "0123456789abcdefghijklmnopqrstuvwxyz") { /* {{{ */
$s = "";
for ($i = 0; $i != $n; ++$i)
$s .= $alph[mt_rand(0, 35)];
return $s;
} /* }}} */
} /* }}} */ } /* }}} */
/** /**