oTree Forum >

Randomizing a list and storing the order after randomization

#1 by cmass62 (edited )

Hi everyone, 

For our experimental game, we define a few sequences (i.e., lists) like this in Constants: 
AMOUNT_0 = [0, 0, 0, 0, 0, 0, 5, 5, 10, 30]

Ideally, we would like to randomize each list and store the order of this randomization as a variable, so that we can then pass it to Javascript (to include this in an animation). We also need to know the order of the elements in the list for analysis after the experiment.

So far, I have had no success with storing the order of the elements because the oTree fields do not support this (i.e., there are 10 elements, so I think this would require another type of field like CharField?). Also, I don't think you can modify anything that is defined under Constants.

I would really appreciate any solutions on how to store the order of an existing list that has been randomized. Thank you in advance!!

Write a reply

Set forum username