It was mostly used as an example of how to manipulate the hate lists. To give an idea of how to do what you want to do that way I still suggest Joli's idea.
Ex:
Code:
#find npc of npc type 123456
my $parent_npc = $entity_list->GetMobByNpcTypeID(123456);
if($parent_npc) {
my $random_target = $parent_npc->GetHateRandom();
#do something
}