I just remembered that there is a macro file that is pretty close to what you want. It is in pg/macros/problemRandomize.pl, and it implements a re-randomize feature. The condition for re-randomizing isn't the one you are looking for, but you should be able to modify it for that. (I'm not sure I'll get to it for a while.)
This macro file was new at the end of the summer, so you might not have it in your copy of pg/macros. If so, you can get it from the CVS repository:
This file is probably a better starting place than the compoundProblem macros.
retry problem with hint and different parameters
This forum has a limit to the number of forum postings you can make in a given time period - this is currently set at 10 posting(s) in 1 day