Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 311 and 402] [Versions 311 and 403]

A {@link \question_variant_selection_strategy} that randomly selects variants that were not used yet.

Copyright: 2015 The Open University
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 137 lines (5 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

least_used_strategy:: (2 methods):
  __construct()
  choose_variant()


Class: least_used_strategy  - X-Ref

A {@link \question_variant_selection_strategy} that randomly selects variants that were not used yet.

If all variants have been used at least once in the set of usages under
consideration, then then it picks one of the least often used.

Within one particular use of this class, each seed will always select the
same variant. This is so that shared datasets work in calculated questions,
and similar features in question types like varnumeric and STACK.

__construct(\question_usage_by_activity $quba, \qubaid_condition $qubaids)   X-Ref
Constructor.

param: question_usage_by_activity $quba the question usage we will be picking variants for.
param: qubaid_condition $qubaids ids of the usages to consider when counting previous uses of each variant.

choose_variant($maxvariants, $seed)   X-Ref
No description