MDL-41198 lib: Allow PHP to generate random seed on script start
All mt_srand instances are removed to allow PHP to do the work.
This commit is contained in:
@@ -309,7 +309,6 @@ class entities {
|
||||
$source = str_split($source, 1);
|
||||
|
||||
for ($i = 1; $i <= $length; $i++) {
|
||||
mt_srand((double) microtime() * 1000000);
|
||||
$num = mt_rand(1, count($source));
|
||||
$response .= $source[$num - 1];
|
||||
}
|
||||
|
||||
@@ -7650,7 +7650,6 @@ function random_string ($length=15) {
|
||||
$pool .= 'abcdefghijklmnopqrstuvwxyz';
|
||||
$pool .= '0123456789';
|
||||
$poollen = strlen($pool);
|
||||
mt_srand ((double) microtime() * 1000000);
|
||||
$string = '';
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
$string .= substr($pool, (mt_rand()%($poollen)), 1);
|
||||
@@ -7671,7 +7670,6 @@ function complex_random_string($length=null) {
|
||||
$pool = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||
$pool .= '`~!@#%^&*()_+-=[];,./<>?:{} ';
|
||||
$poollen = strlen($pool);
|
||||
mt_srand ((double) microtime() * 1000000);
|
||||
if ($length===null) {
|
||||
$length = floor(rand(24, 32));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user