I'm writing some test case generators and, for the umpteenth time, having to craft combination and permutation generation loops.

 

I see that there is a "permutation iterator" that scrambles ranges.  That's a good and useful tool but it isn't enough for what I have in mind.

 

I'd like a set of tools that will provide both exhaustive and random combinations and permutations of N items from M item sets or multisets (represented in a variety of concrete ways and with M >= N).  Admitting multisets moves the problem from first-year to second- or third-year level.  I like to keep things interesting ;-)

 

Any suggestions?

 

I am putting some effort into generalizing the interface to the code I'm hacking on now but I doubt my management will permit me to contribute it to boost.  Maybe, since it is used only for testing.  We'll see.  But if somebody else started the ball rolling I could take pot shots at their work.

 

-swn

 

PS: The specification above could be expanded to include a pairwise test case generator, or that could be considered another library suggestion.  These things are usually needed at a utility level rather than inside a compiled test driver but there are exceptions.  See http://www.pairwise.org/tools.asp .