Permalink
Browse files

Merge branch 'MDL-41198-24' of https://github.com/mr-russ/moodle into…

… MOODLE_24_STABLE
  • Loading branch information...
2 parents ceb2394 + 3cc1d4b commit e575b2f6d1bfb79ea54854b5a7d45d17f29f92e1 @danpoltawski danpoltawski committed Dec 18, 2013
View
@@ -941,7 +941,6 @@ function cron() {
// run the keepalive client
$this->keepalive_client();
- // admin/cron.php should have run srand for us
$random100 = rand(0,100);
if ($random100 < 10) { // Approximately 10% of the time.
// nuke olden sessions
@@ -309,7 +309,6 @@ public function generate_random_string ($length = 6) {
$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];
}
View
@@ -169,11 +169,6 @@ function ADODB_Setup()
die("Illegal path http:// or ftp://");
}
-
- // Initialize random number generator for randomizing cache flushes
- // -- note Since PHP 4.2.0, the seed becomes optional and defaults to a random value if omitted.
- srand(((double)microtime())*1000000);
-
/**
* ADODB version as a string.
*/
@@ -19,6 +19,6 @@ Added:
* readme_moodle.txt - this file ;-)
Our changes:
- * none
+ * Removed random seed initialization from lib/adodb/adodb.inc.php:172
skodak, iarenaza, moodler, stronk7
View
@@ -67,7 +67,6 @@ function cron_run() {
// Run cleanup core cron jobs, but not every time since they aren't too important.
// These don't have a timer to reduce load, so we'll use a random number
// to randomly choose the percentage of times we should run these jobs.
- srand ((double) microtime() * 10000000);
$random100 = rand(0,100);
if ($random100 < 20) { // Approximately 20% of the time.
mtrace("Running clean-up tasks...");
View
@@ -9213,7 +9213,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);
@@ -9234,7 +9233,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));
}
@@ -9542,7 +9540,6 @@ function unformat_float($locale_float, $strict = false) {
*/
function swapshuffle($array) {
- srand ((double) microtime() * 10000000);
$last = count($array) - 1;
for ($i=0;$i<=$last;$i++) {
$from = rand(0,$last);
@@ -9582,7 +9579,6 @@ function swapshuffle_assoc($array) {
* @return array
*/
function draw_rand_array($array, $draws) {
- srand ((double) microtime() * 10000000);
$return = array();
@@ -2016,12 +2016,10 @@ public function test_permission_evaluation() {
$userids = array_slice($userids, 0, 5);
}
- // Random time!
- //srand(666);
- foreach($userids as $userid) { // no guest or deleted
- // each user gets 0-10 random roles
+ foreach ($userids as $userid) { // No guest or deleted.
+ // Each user gets 0-10 random roles.
$rcount = rand(0, 10);
- for($j=0; $j<$rcount; $j++) {
+ for ($j=0; $j<$rcount; $j++) {
$roleid = $roles[rand(0, count($roles)-1)];
$contextid = $contexts[rand(0, count($contexts)-1)]->id;
role_assign($roleid, $userid, $contextid);

0 comments on commit e575b2f

Please sign in to comment.