MDL-41198 lib: Allow PHP to generate random seed on script start
Most srand instances are removed to allow PHP to do the work. srand was left for group randomization due to the method used. Conflicts: lib/tests/accesslib_test.php
This commit is contained in:
@@ -2016,12 +2016,10 @@ class accesslib_testcase extends advanced_testcase {
|
||||
$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);
|
||||
|
||||
Reference in New Issue
Block a user