Why aren't nested loops used? Then you simply add more nested loops as needed.
You cannot be too efficient, but you indicated that you need to cover the entire sample space, so you will have to run every possible combination of input variable values ββin the future, so I doubt that you can do much if it cannot only evaluate part of the state space.
int min = 0; int max = 9; for( int a = min ; a <= max ; ++a ) for( int b = min ; b <= max ; ++b ) blackBox( a , b );
In addition, I think you will find the number of unique calls (max - min + 1) ^ n , and not vice versa.
Edit:
Different runtime version for already proposed
Imre L seems to have hit a nail on the head for a real-time version using the same type of language as your question (something similar to C), but since you marked this as a language agnostic I decided to try something different ( also, I'm learning Python at the moment, so I was looking for an excuse to practice).
Here's the real-time version of Python, in each case x will be an n-tuple, for example [1,0,3,2] . The only thing I will say is that it does not include max in the state space (in the example below it will use from 0 to 2 inclusive, and not 3), so before using it you will need to increase max .
import itertools min = 0 max = 3 n = 4 for x in itertools.product(range(min,max), repeat=n): blackBox( x )
DMA57361
source share