LOL, the script example I gave above just happens to be related to handling player race sizes. So, you should be able to use the array from that script and set the size of the NPC with something like this:
Code:
%RaceSizes = (
1 => 6, # Human
2 => 8, # Barbarian
3 => 6, # Erudite
4 => 5, # Wood Elf
5 => 5, # High Elf
6 => 5, # Dark Elf
7 => 5, # Half Elf
8 => 4, # Dwarf
9 => 9, # Troll
10 => 9, # Ogre
11 => 3, # Halfling
12 => 3, # Gnome
128 => 6, # Iksar
130 => 6, # Vah Shir
330 => 5, # Froglok
522 => 6, # Drakkin
);
$npc->ChangeSize($RaceSizes{$randomrace});
Of course, you would need to do that after you set the $randomrace variable.