I have p strictly ascending values, x0 < x1 < ... < xp
I would like to generate all possible arrays of size n filled with the above values for which a[0] <= a[1] <= ... <= a[n-2] <= a[n-1]. For example:
[x0, x0, x0, ... , x0]
[x0, x1, x1, ... , x1]
[x0, x0, x1, ... , x1]
[x1, x2, x3, ... , x3]
etc...
What would be the most elegant and efficient way of doing so?