String database[] = {\'a\', \'b\', \'c\'};
I would like to generate the following strings sequence, based on given database
.
For anyone looking for non-recursive options, here is a sample for numeric permutations (can easily be adapted to char
. numberOfAgents
is the number of columns and the set of numbers is 0
to numberOfActions
:
int numberOfAgents=5;
int numberOfActions = 8;
byte[][]combinations = new byte[(int)Math.pow(numberOfActions,numberOfAgents)][numberOfAgents];
// do each column separately
for (byte j = 0; j < numberOfAgents; j++) {
// for this column, repeat each option in the set 'reps' times
int reps = (int) Math.pow(numberOfActions, j);
// for each column, repeat the whole set of options until we reach the end
int counter=0;
while(counter