how to move random servo

I have a bank of 4 servos, I am getting a random number from 2-5 and want to move a servo based on that number. It is all working fine if I use a switch case in the logic, but I would like to remove the switch case and make the write call dynamic.

#include <Servo.h>
Servo myS2;
Servo myS3;
Servo myS4;
Servo myS5;
int randomInt = 0;
int prevRand = 0;


void setup() {
  randomSeed( analogRead(A0) );
  myS2.attach(2);
  myS3.attach(3);
  myS4.attach(4);
  myS5.attach(5);
}

void loop() {

  for(int x=0; x < 10; x++){
    randomInt = random(2,6);
    while(randomInt == prevRand){
      randomInt = random(2,6); 
    }
    prevRand = randomInt;

    switch (randomInt) {
    case 2:
      myS2.write(5);
      break;
    case 3:
      myS3.write(5);
      break;
    case 4:
      myS4.write(5);
      break;
    case 5:
      myS5.write(5);
      break;
  }
 
  }

}

I have tried adding in these variables

char choice = 'mys';
char choice2;

then replacing the switch with this

choice2 = choice + randomInt;
choice2.write(5);

so i was essentially trying to dynamically write that class name and add it in to the write, but I am getting this error
request for member ‘write’ in ‘choice2’, which is of non-class type ‘char’

any ideas on another way to make that part dynamic?

Use a random index into an array of function pointers (servo.write functions).

You cannot create source code at runtime, C++ is not a dynamic language in that sense.

You need an array of servo objects.

While it is possible to use an array of pointers and that would be a good solution for more than a handful, the switch case is pretty good. That would be my choice for this application.

Why do you think the switch is bad? Your code looks really good to me.