I don’t know why I cannot wrap my head around the coding for what I want to do. I need some help.
I want to make a quiz that randomly assigns all students a different problem. In a graph, I made two lists. The first was D=[1,2,4,8] and the second was N=[1…10]. I would like to randomly choose a value from D called d_1 and another from D I would call d_2. Similarly, i would choose two values from N. Then, in a Note, I could present those values as a fraction edition problem (n_1/d_1) + (n_2/d_2) for the students to solve. Students could then write their answer in a math input component to be checked against the answer I compute through the graphing component. How would I do this, or where can I find CL documentation and examples to mimic.
It sounds like you just needed help with lists in the graph, so here’s an example of what you described. From here, you can call on the numerator and denominator variables in the note.
Thank you for the example. That gives me some extra ideas with which to work. When I looked at your use of shuffle, it always gave me the same values for each variable. I tried to open the code multiple times to see if it would change, but it did not. Where can I locate syntax for shuffle in the desmos calculator component? I don’t see anything about shuffle in the CL documentation online.
The shuffle function is part of the graphing calculator, so you won’t find it in the CL documentation. There are two ways to re-shuffle your lists. The easiest way is to just press the wavy arrows at the top of the expression list. Each press will shuffle the lists. The second way is to pass a second parameter to the function. Here’s an example of this from the original graph from before.
I was just thinking, and maybe I misunderstood your original post, but if you are looking to have students try several problems per screen, you don’t need to rely on the graphing calculator. If you use a note component and a math input, you can accomplish the same task. In the note component, use this code:
r = randomGenerator(input.submitCount)
numerator1 = when input.timeSinceSubmit>0 input.lastValue("numerator1") otherwise r.int(1,10)
denominator1 = when input.timeSinceSubmit>0 input.lastValue("denominator1") otherwise numericValue(`2^{${r.int(0,3)}}`)
numerator2 = when input.timeSinceSubmit>0 input.lastValue("numerator2") otherwise r.int(1,10)
denominator2 = when input.timeSinceSubmit>0 input.lastValue("denominator2") otherwise numericValue(`2^{${r.int(0,3)}}`)
problemDisplay = `\frac{${numerator1}}{${denominator1}}+\frac{${numerator2}}{${denominator2}}`
In the input component, use this code to capture the random values.