Rather than start with that expression, I think I’d take a different approach.
Assuming that all layers in your comp are participating in this random lottery, you could add a new null layer (named “controls”) with a slider contol and move it to the bottom of the layer stack. You would then add this exression to the slider:
minDur = .1;
maxDur = .5;
n = index-1;
seedRandom(index,true);
curTime = 0;
curIdx = Math.floor(random(n));
while (curTimeRather than start with that expression, I think I’d take a different approach.
Assuming that all layers in your comp are participating in this random lottery, you could add a new null layer (named “controls”) with a slider contol and move it to the bottom of the layer stack. You would then add this exression to the slider:
minDur = .1;
maxDur = .5;
n = index-1;
seedRandom(index,true);
curTime = 0;
curIdx = Math.floor(random(n));
while (curTime