"Are you saying that the newer version of the package you downloaded doesn't have this problem?"
Oops - no - I had thought so, but I've now tested more and I was wrong. Sorry!
I've now tested more thoroughly, and here's a minimal pair of broken/unbroken questions, with my thoughts on what's broken:
- Please download the SCORM package for this question and upload it to Moodle: https://numbas.mathcentre.ac.uk/question/183206/a3-q3-probability-formulas/
If I complete the quiz in one sitting, or use the inbuilt Pause and Resume buttons, no problems occur. But if I leave the Moodle page and return, or use the refresh button in my browser - something that causes Moodle to relaunch the package - then the values of probsA and probsB are the same, but the values of probscap (and the dependent variable probscup) change. This causes formerly correct answers in parts (a) and (b) to be marked incorrect if the values have changed (though they are still marked correct if, coincidentally, the randomisation picked the same numbers both times).
- Next, try this one: https://numbas.mathcentre.ac.uk/question/184981/testing-billy-s-copy-of-a3-q3-probability-formulas/ This one does not have the same problem. I can relaunch the quiz as many times as I like and it's fine.
The difference between the questions is that, in question 1, I have
probscap = map(i -> random(10 .. floor(2*min(probsA[i], probsB[i])/3)), 0..3)
and in question 2, I've separated this out into
probscap = [random(10 .. floor(2*min(probsA[0], probsB[0])/3)),
random(10 .. floor(2*min(probsA[1], probsB[1])/3)),
random(10 .. floor(2*min(probsA[2], probsB[2])/3)),
random(10 .. floor(2*min(probsA[3], probsB[3])/3))]
(The other broken question in my quiz also has a random inside a map; the unbroken questions don't.)
The SCORM suspend data gives another hint in this direction. In question 1:
"variables":{"probsa":"[ 36, 47, 41, 49 ]","probsb":"[ 38, 44, 39, 46 ]"}
In question 2:
"variables":{"probsa":"[ 54, 54, 30, 34 ],","probsb":"[ 42, 33, 43, 52 ]","probscap":"[ 25, 22, 19, 12 ]"}
Question 1 hasn't realised that it has to store probscap! Since there's no value stored, it can't restore it when the SCORM is relaunched, so I guess it must just be generating them from scratch each time.
My guess is it must be somewhere in the Numbas.jme.isDeterministic function, but at a glance I don't fully understand how it works, so I'll stop digging here...