You're forgetting to tell the function to return an actor. By default, functions return an integer, so if you don't specify otherwise ($,#,%, or .YourTypeName) it'll return an integer.
Type actor Field x Field y Field z End Type Dim actors.actor(10) For n=0 to 9 actors.actor(n)=test_func() next Function test_func.actor() entity.actor=New actor entity\x = rnd(-10,10) entity\y = rnd(-10,10) entity\z = rnd(-10,10) Return entity End Function