Random layer movement with pauses

Move a layer to a new random position in a random amount of time and pause in this position for a random amount of time. Then move to the next random position and so on… All the max/min random values should be set in separate variables.

moveMin = .3; //minimum move time
moveMax = .7; //maximum move time

pauseMin = .1; // minimum pause time
pauseMax = .1; // maximum pause time

minVal = [30,32];
maxVal = [55,53];
endT = 0;
j = 0;
k = 0;
while ( time >= endT){
  j += 1;
  seedRandom(j,true);
  startT = endT;
  if (j%2){
    endT += random(moveMin,moveMax);
    k++;
  }else{
    endT += random(pauseMin,pauseMax);
  }
}
if (j%2){
  seedRandom(k,true);
  endVal = random(minVal,maxVal);
  seedRandom(k-1,true);
  startVal = random(minVal,maxVal);
  ease(time,startT,endT,startVal,endVal)
}else{
  seedRandom(k,true);
  random(minVal,maxVal)
}