Wildcards in Calculated Question (ver 3.0)

Re: Wildcards in Calculated Question (ver 3.0)

by Matthias Giger -
Number of replies: 0
Picture of Particularly helpful Moodlers

The easiest way to include a random name is to include a small javascript into your question.

I didn't try it in calculated questions, but it certainly works in the cloze question type.


Go to the HTML view and enter something like this:


<p>Just an example.</p><p>Hi 
<script>
var names = ["Steven","Peter","James","Ralph"];
n = Math.trunc(Math.random()*names.length);
document.write(names[n]);
</script>
</p><p>What is the sum of 2 + 2 = {1:NM:=4}.<br></p>


I use small scripts like this, if I want students to work on different topics.

The only problem with the approach, it is not permanent. When you reload the question another name will appear, but I think for your purpose it doesn't really matter.