How to fetch X random entities of a given type using rules?
Investigate the Views Module.  It can create lists of nodes for you.  Investigate node_load() and node_save().  They will allow you to modify those nodes.