Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

Differences Between: [Versions 310 and 402] [Versions 311 and 402] [Versions 39 and 402] [Versions 400 and 402] [Versions 401 and 402]

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