mirror of
https://github.com/torrentpier/torrentpier-lts.git
synced 2025-02-28 15:10:54 +03:00
Merge pull request #4 from torrentpier/simplified-make_rand_str-function
Simplified make_rand_str function
This commit is contained in:
commit
ac33bb064b
@ -301,12 +301,7 @@ function str_compact ($str)
|
||||
|
||||
function make_rand_str ($len = 10)
|
||||
{
|
||||
$str = '';
|
||||
while (strlen($str) < $len)
|
||||
{
|
||||
$str .= str_shuffle(preg_replace('#[^0-9a-zA-Z]#', '', crypt(uniqid(mt_rand(), true))));
|
||||
}
|
||||
return substr($str, 0, $len);
|
||||
return substr(str_shuffle(str_repeat('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', (int)$len)), 0, $len);
|
||||
}
|
||||
|
||||
// bencode: based on OpenTracker
|
||||
|
Loading…
Reference in New Issue
Block a user