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:
Russell Smith
2013-12-18 16:53:04 +11:00
parent 8703e6530c
commit dd7e948dba
2 changed files with 0 additions and 3 deletions
-1
View File
@@ -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];
}
-2
View File
@@ -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));
}