Your code is not escaped correctly so we cannot review it. In any case you need to get familiar with the object model.
Zenphoto 1.4.3's (and therefore the beta) has a random images options within the image_album_statistics function (the base getImageStatistics() has but there is no wrapper function itself).