And the answer is: cpmfetch...
There are many options to filter media - such as:
getLastAddedMediaFrom... any of the cpmfetch functions ending in 'From' accept a source parameter that allow you to filter.
The source can be any or all of: cat, album, owner, keyword, or text.
"cat=5,6" - Use photos from categories 5 or 6
"cat=5,6:album=10" - Use photos from categories 5 or 6 or album 10.
So to view random media from a single category: $objCpm->cpm_viewRandomMediaFrom("cat=1",1, 4, $options);
See the cpmfetch doc for more examples (folder docs supplied with cpmfetch) or view here: http://greggallery.gmcdesign.com/cpmfetch/docs/basic
Classes: Class cpm lists all the possibilities
The tutorial gives some examples.