Hello everybody,
I hope you are doing good!
I have five conditions in my experiment and each participant should be assigned to one.
I have written a piece of code to do this and it does its job pretty fine so anyone in a similar situation can use it. The code (JS) is below:
a, b, c, d, e, randnum;
randnum = Math.random();
if (((randnum >= 0) && (randnum < 0.2))) {
a = 1;
b = 0;
c = 0;
d = 0;
e = 0;
} else {
if (((randnum >= 0.2) && (randnum < 0.4))) {
a = 0;
b = 1;
c = 0;
d = 0;
e = 0;
} else {
if (((randnum >= 0.4) && (randnum < 0.6))) {
a = 0;
b = 0;
c = 1;
d = 0;
e = 0;
} else {
if (((randnum >= 0.6) && (randnum < 0.8))) {
a = 0;
b = 0;
c = 0;
d = 1;
e = 0;
} else {
a = 0;
b = 0;
c = 0;
d = 0;
e = 1;
}
}
}
}
However, in the pilot study, I realized that I have no idea which participant has been assigned to which group. So my question is that how can I save the output of this code component so I know that for example participant 1 has taken task “a” and so on …
Any help is highly appreciated