Blinking LEDs for a set number of times followed by another action

Ok, I think I'm getting a bit closer but am not sure if this is the best way of going about it. In fact, I'm sure there must be a better way. Here is the combined code:

int pin2 = 2;
int pin3 = 3;
int pin4 = 4;


long timestamp = 0;  // long is a much larger integer
boolean ledState = LOW;   
int delayLength = 500; // how long between intervals 

int ranNum;
int ranDel;

int maxnum = 1; //Blink random LED 1 time
int count = 0; //Blink counter


void setup() {
  
  randomSeed(analogRead(0));  
    
  pinMode(pin2, OUTPUT);
  pinMode(pin3, OUTPUT);
  pinMode(pin4, OUTPUT);
    
  Serial.begin(9600);
  
}

void loop() {

  // make all 3 LEDs flash 3x
  if ( (millis() - timestamp > delayLength) && (timestamp < 2506) ) {
    // half a second has passed and timestampe is less than 2506, do:
    ledState = !ledState; // toggles the ledState between true/false
    digitalWrite(pin2, ledState); // make the led change
    digitalWrite(pin3, ledState);
    digitalWrite(pin4, ledState);
    timestamp = millis();
    Serial.println(timestamp); 
  } 
  
    //light up one LED at random for 4 seconds
  if ( (timestamp > 2510) && (count < maxnum) ) {
  ranNum=random(2,5);
  digitalWrite(ranNum, HIGH);
  delay(4000);
  digitalWrite(ranNum, LOW);
  delay(2000);
  Serial.println(count);
  
  count++; //increments count making if statement false
  }
  
}

When I run this code, it flashes all 3 LEDs 3x and then turns off 2 of them at random leaving 1 random LED on. This more or less achieves what I want; however, I'd prefer that 1 random LED turn ON rather than 2 random LEDs turning off. The other, more significant problem, is that I don't know how to now loop this. As it stands, it runs once and then stops altogether because I've based my if() statements on timestamps and I'm not sure that timestamps can be reset.

And while I don't want to get too ahead of myself, I have to keep in mind that I also have to be able to use a slide potentiometer on a completely different set of LEDs and have these LEDs react to the pot in real time.