Students Seeing Different Random Number Sets

In this activity, two sets of 100 random values are calculated in the graph on screen 2. I’d assumed that all students would see the same random sets but I’m being told that is not the case. What am I doing wrong? Thanks for any help!

Am I wrong that CL generates different seeds for the random functions on each client?

Thanks, that makes sense. I’ll try using an explicit seed in each random call…

…alas, that hasn’t solved the problem. To clarify the issue I’ve created a test activity:

In this activity a set of 50 random integers are generated from a normal distribution, with a mean of 5 and standard deviation of 1. These are created within a hidden graph object called ‘Data’. A seed is specified for the random function, and the graph object seems to produce the same 50 numbers each time, visible within the graph script. The problem is that when the numbers are extracted during execution of the activity they are different from those shown in the code and change on each activation? In the activity the numbers are copied into another graph object to display them in bar chart form and into a table object where they are listed. These match each other but change on each preview.

Also tried a simpler “[1…10].random(50,0.5)“ but still the issue persists. It looks as if the seed is being ignored at run time?

1 Like

If I remember correctly, the seed works per-student (the same seed for the same student will result in the same random output), but does not lead to the same output across students. In my understanding, the only way to get common values across sessions would be with the aggregate function, but that also can tend to be a little laggy (but might be reasonable if you want to set up the random values in a much earlier slide than when they’re used).

Though I’ll take a closer look at the graph-data extraction later if nobody else gets to it, that definitely seems like a separate problem.

If it isn’t absolutely necessary, I would suggest for now just make up numbers for the activity.

@NTMDev and @Andrew_Baas are correct that for random values generated by CL are unique (within reason) for each student. However, random values generated within a graph will be consistent across all students.

Edit: This may not be the case any more. I’m seeing different graph values as well for different students.

If you need the same random set of values for each student, I suggest using a random function in the graph and an action to set the needed variable. That way it’s a fixed list. (Example here).

2 Likes

Thank you @Andrew_Baas , @NTMDev and @Daniel_Grubbs. Clearly there is an issue here!

By definition, a pseudo-random number generator should produce a sequence that is completely determined by its seed. As that is not happening, presumably this is a ‘bug’?

Daniel, I don’t understand how what you are suggesting differs in principle from what is already happening in the test activity I posted? Is a list ‘fixed’ simply by assigning it to a variable?

Some form of workaround may be possible if someone can identify all the factors affecting the sequence? …otherwise the alternative seems to be a cumbersome restrictive two-step process to first generate the numbers and then type them into a table.

If you want all students to have the same list of values, you need to have it hard-coded into the activity. Using an action does not define a variable as whatever code you used, but as the output of that calculation. So if you define a variable as a randomized list, and then use an action to define another variable, the new variable will be just the list of values. If you update the randomized list, it will not affect the variable set by the action until you physically run the action.

Looking back into your activity, you may have put the table in the first screen to make it easier to change those parameters. If you hard code those into the graph on Screen 2, then use my suggested technique to generate your randomized lists. It looks like C_s and D_t are the only randomly generated lists, which are dependent on those variables from the table which can’t vary once the activity is published and assigned.

Sorry Daniel, the concept of an ‘action’ is new to me. I’ve followed the code sample you provided and every time I preview the test activity (now updated) the same collection of values appears. I’ll get someone else to confirm that students also see the same values and report back.

Right. It should now be a fixed list. Is that not what you wanted? If you see the Preview changing every time, that means each student will have a different set of values. You’ll probably still want/need to join your student data to the appropriate lists.

Yes, the different seed is not consistent when you making a desmos graph with random( ), and reload it. The seed stays the same (I think loaded with the graph). This means you should probably make a random( ) function in a graph and then call it

Again,thank you @Andrew_Baas , @NTMDev and @Daniel_Grubbs. My conclusion is:

  1. The initial version of the activity I posted really should work, but there is a quirk in Desmos stopping that. I’ll post a separate bug report about it.
  2. To make the activity work, it has been necessary to create a fixed list, taking away parameters to the graph creating the list.
  3. It initially looked as if the fixed list would have to be created in two stages, using a separate activity to generate the numbers, which would then be transferred manually to the main activity. Thanks to @Daniel_Grubbs, however, I now know a way to create fix lists using an ‘action’ control! It would be useful to see it included in the documentation for the random function.

I asked about this and I was told that it was intentional that each should have a different randomization. And, likely what I thought was graphs being consistent between students was actually the Preview only consistently showing the same values. So not a bug. It’s intentional.

Actions are certainly not confined to random(). I’ve used them when building complex animations for the curriculum. Our layouts or sizing can change through the process, so I often have variable dependent spacing and such. Strings of dependent calculations, particularly with lists, can reduce performance, so I sometimes used actions to define lists I knew would need to change once complete.

Yes, I’ve looked at the documentation. Strangely, it implied this feature needed to be switched on, but I didn’t do that before using it?

It is the only feature in the “Advanced” section of the Account Settings (the dropdown upper right with your name) on the calculator site, but there aren’t the same requirements to select features for graphs in the Activity Builder.