Hi,
Thank you very much for developing Lioness.
I have groups with three players in each and would like to randomly assign the different groups to 3 different treatments. The whole group get the same treatment.
If I just write
if (period == 1){
treatment = 1 + (groupNr-1) % 3;
record('treatment', treatment);
}
the treatment assignment is not random, but deterministic.
I tried to assign one player in the group to a treatment first and then the others in the group get the same treatment, but with the code I used some groups got different treatment. This is the code:
function ff() {
let treatment = getValuesOthers('firstTreatment').find(t => typeof t == 'number');
if (treatment > 0) {
return treatment;
} else {
treatment = 1 + Math.floor(Math.random()*3);
record('firstTreatment', treatment);
return treatment;
}
}
if (period ==1){
treatment = ff();
record('treatment', treatment);
}
if (period >1){
treatment = getOldValue('treatment', treatment);
record('treatment', treatment);
}
Thank you for any help!
Best, Gøril