You are here

function _cloze_shuffle_choices in Cloze 7

Same name and namespace in other branches
  1. 6 cloze.module \_cloze_shuffle_choices()
2 calls to _cloze_shuffle_choices()
ClozeQuestion::getAnsweringForm in ./cloze.classes.inc
Implementation of getAnsweringForm
ClozeResponse::getReportForm in ./cloze.classes.inc
Implementation of getReportForm()

File

./cloze.module, line 88

Code

function _cloze_shuffle_choices($choices) {
  $new_array = array();
  $new_array[''] = '';
  while (count($choices)) {
    $element = array_rand($choices);
    $new_array[$element] = $choices[$element];
    unset($choices[$element]);
  }
  return $new_array;
}