-
Random frames without repeat
I’ve been searching around for a few hours to get this done.
I have a 12fps composition containing 132 unique frames. I want the composition to play the frames in random order, without repeating a frame.I found multiple scripts, of which the one from this thread came very close: https://forums.adobe.com/message/4577715
fr = 12; // frame rate;
numFrames = 132;
seedRandom(index,true);
seg = Math.floor(time*fr);
f = Math.floor(random(numFrames));
for (i = 0; i < seg; i++)
f = (f + Math.floor(random(1,numFrames)))%numFrames;
framesToTime(f);
Only the thing is, I see frames being repeated a few times. I tried messing around a bit, but I can’t seem to get it right. What do I add to prevent this? (and where in the code)