How do I use a variable to determine a characters class?

Hi, for more information, I am making a game where you catch monster people. And I am using a variable to determine their personalities, and I want there to be a bit of RNG so they aren't all the same.

I am also using variables to determine what slot they take over, so I wanted to know if there was an easier way to do it than going through each slot.

In my mind it would be slot x == class x
But I'm not sure how to translate it to code.

Thank you so much for reading all the way through!
In the Interpreter the code for the change class command is as follows
#--------------------------------------------------------------------------
# * Change Class
#--------------------------------------------------------------------------
def command_321
actor = $game_actors[@params[0]]
actor.change_class(@params[1]) if actor && $data_classes[@params[1]]
end

I believe in VX Ace the call for an actor's position is $game_party.members[x] where x = the actor's visible position in the menu - 1 (Computers start at 0).

So I think $game_party.member[x].change_class($game_variables[y])

y = personality variable that refers to class id in database.

Original thread: https://forums.rpgmakerweb.com/threads/how-do-i-use-a-variable-to-determine-a-characters-class.151923/