mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-11-27 18:10:42 +00:00
add method makeRandomString()
This commit is contained in:
parent
917ba91d95
commit
3782e71ae6
|
|
@ -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;
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user