I have an oracle that samples uniformly from sets of size up to around n or n2.
How do I efficiently approximate a uniform distribution on the set of non-decreasing sequences of length k whose terms are from {1,2,…,n} (using the oracle)?
This set has about (n+k−1) choose k elements, O(n^k), and is too big to directly use the uniform oracle.
Sample values that give trouble are (n=31,k=26) and (n=31,k=100). In particular, k will always be a bit large compared to n, so there is a substantial difference between non-decreasing (what I want) and increasing.
Things that don't work:
Pick the first term uniformly, then pick the second term uniformly from the [a1…n], then pick the third term uniformly from [a2…n], etc. The resulting distribution is too heavily skewed to be useful (1≤1≤…≤1 has probability (1/n)k, while n≤n≤…≤n has probability 1/n).
Sampling uniformly from {1,2,…,n}k and then sort the result is also too heavily skewed. For n=k, 1≤2≤…≤n is n! times more likely than 1≤1≤…≤1.
Sampling uniformly from {1,2,…,n}k and discarding unsorted sequences is not efficient enough (something in the range of k! oracle calls per sample produced; for n=31, k=26, it is 89704535825984961898313 calls per sample).
Another approach that is fine by me:
What is an efficiently computable bijection between {1,2,…,Binomial(n+k−1,k)} and the set of non-decreasing sequences of length k whose terms are positive integers less than or equal to n?
I can sample uniformly at random from {1,2,…,m} for m up to nk using a different oracle. Hence if I can efficiently convert from positive integers to sequences, then that is a good solution.