Generating all possible permutations for a given base and number of digits <p>I'm sure this is pretty simple, but I'm stumped for a way to do this. Essentially if I have an array with P collumns and V^P rows, how can I fill in all the combinations, that is, essentially, all possible numbers in base V of P digits. For example, for P=3 and V=2:</p> <pre><code>000 001 010 011 100 101 110 111 </code></pre> <p>Keep in mind that this is an 2 dimensional array, not an array of ints.</p> <p>For P=4 and V=3.</p> <pre><code>0000 0001 0002 0010 0011 0012 .... </code></pre> <p>Having this array generated, the rest of work for what I'm trying to devolop is trivial. So having some code/tips on how to do this would be greatly appreciated. Thanks.</p>