I'm using Javascript at the moment but open to anything. I want to generate every possible combination of elements of an array of size X where each element can only be N different values
For example I have an array size of X = 3, and different values of N = 2
001 011 111 100 110 000 010 101
I think that's all the combinations. I feel like this should be a common programming issue and a simple task but haven't been able to find anything that reflects what I need, most cases don't take into the account the possibility of multiple occurrences of the same number (e.g. 111)