Skip to content

Commit

Permalink
Merge branch 'MDL-41198-master' of https://github.com/mr-russ/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
danpoltawski committed Dec 18, 2013
2 parents 2415e85 + 33766d3 commit eab9fa0
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 15 deletions.
1 change: 0 additions & 1 deletion auth/mnet/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion backup/cc/entities.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
Expand Down
5 changes: 0 additions & 5 deletions lib/adodb/adodb.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/adodb/readme_moodle.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion lib/cronlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,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...");
Expand Down
4 changes: 0 additions & 4 deletions lib/moodlelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -7655,7 +7655,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);
Expand All @@ -7676,7 +7675,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));
}
Expand Down Expand Up @@ -7976,7 +7974,6 @@ function unformat_float($localefloat, $strict = false) {
*/
function swapshuffle($array) {

srand ((double) microtime() * 10000000);
$last = count($array) - 1;
for ($i = 0; $i <= $last; $i++) {
$from = rand(0, $last);
Expand Down Expand Up @@ -8016,7 +8013,6 @@ function swapshuffle_assoc($array) {
* @return array
*/
function draw_rand_array($array, $draws) {
srand ((double) microtime() * 10000000);

$return = array();

Expand Down
2 changes: 0 additions & 2 deletions lib/tests/accesslib_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -2274,8 +2274,6 @@ 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.
$rcount = rand(0, 10);
Expand Down

0 comments on commit eab9fa0

Please sign in to comment.