public function random_question(structure $structure, $slotnumber, $pageurl) {

        $question = $structure->get_question_in_slot($slotnumber);
        $slot = $structure->get_slot_by_number($slotnumber);
        $slottags = $structure->get_slot_tags_for_slot_id($slot->id);
        $editurl = new \moodle_url('/mod/quiz/editrandom.php',
                array('returnurl' => $pageurl->out_as_local_url(), 'slotid' => $slot->id));

        $temp = clone($question);
        $temp->questiontext = '';
        $instancename = quiz_question_tostring($temp);

        $configuretitle = get_string('configurerandomquestion', 'quiz');
        $qtype = \question_bank::get_qtype($question->qtype, false);
        $namestr = $qtype->local_name();
        $icon = $this->pix_icon('icon', $namestr, $qtype->plugin_name(), array('title' => $namestr,
                'class' => 'icon activityicon', 'alt' => ' ', 'role' => 'presentation'));

        $editicon = $this->pix_icon('t/edit', $configuretitle, 'moodle', array('title' => ''));
        $qbankurlparams = array(
            'cmid' => $structure->get_cmid(),
            'cat' => $question->category . ',' . $question->contextid,
            'recurse' => !empty($question->questiontext)
        );

        foreach ($slottags as $index => $slottag) {
            $qbankurlparams["qtagids[{$index}]"] = $slottag->tagid;
        }

        // If this is a random question, display a link to show the questions
        // selected from in the question bank.
        $qbankurl = new \moodle_url('/question/edit.php', $qbankurlparams);
        $qbanklink = ' ' . \html_writer::link($qbankurl,
                get_string('seequestions', 'quiz'), array('class' => 'mod_quiz_random_qbank_link'));

        return html_writer::link($editurl, $icon . $editicon, array('title' => $configuretitle)) .
                ' ' . $instancename . ' ' . $qbanklink;
    }