As far as I'm aware, NPC's can only be created in either the entities section of the mission file (for either mod or campaign level scripting) or in the NPC.ini file and added to the ship through the .rules files (for campaign level only).
The only way I can think of to add a random character to a ship, would be to pre-create the characters and assign them to a hidden object. From there, you could write a script to pick and move one of them to the target ship.
Not particularly pretty and will probably cost you a useable ship to implement, but it's a start.