Moodle PHP Documentation 4.4
Moodle 4.4.1 (Build: 20240610) (db07c09afc5)
question_variant_pseudorandom_no_repeats_strategy Class Reference

A question_variant_selection_strategy that is effectively random for the first attempt, and then after that cycles through the available variants so that the students will not get a repeated variant until they have seen them all. More...

Inheritance diagram for question_variant_pseudorandom_no_repeats_strategy:
question_variant_selection_strategy

Public Member Functions

 __construct ($attemptno, $userid=null, $extrarandomness='')
 Constructor.
 
 choose_variant ($maxvariants, $seed)
 

Protected Attributes

int $attemptno
 the number of attempts this users has had, including the curent one.
 
string $extrarandomness = ''
 extra input fed into the pseudo-random code.
 
int $userid
 the user id the attempt belongs to.
 

Detailed Description

A question_variant_selection_strategy that is effectively random for the first attempt, and then after that cycles through the available variants so that the students will not get a repeated variant until they have seen them all.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Constructor & Destructor Documentation

◆ __construct()

question_variant_pseudorandom_no_repeats_strategy::__construct ( $attemptno,
$userid = null,
$extrarandomness = '' )

Constructor.

Parameters
int$attemptnoThe attempt number.
int$useridthe user the attempt is for (defaults to $USER->id).

Member Function Documentation

◆ choose_variant()

question_variant_pseudorandom_no_repeats_strategy::choose_variant ( $maxvariants,
$seed )
Parameters
int$maxvariantsthe num
string$seeddata that can be used to controls how the variant is selected in a semi-random way.
Return values
intthe variant to use, a number betweeb 1 and $maxvariants inclusive.

Implements question_variant_selection_strategy.


The documentation for this class was generated from the following file: