You will need to turn on Time Remapping and apply this expression:
holdTime=30; //# of frames to hold for
k1=key(1).time * (1.0 / thisComp.frameDuration);
k2=key(2).time * (1.0 / thisComp.frameDuration);
posterizeTime((1/thisComp.frameDuration)/holdTime);
r=random(k1, k2);
framesToTime(r, fps = 1 / thisComp.frameDuration);
-Lloyd
https://aescripts.com