Given $n \in \mathbb{Z}^+$, I would like to uniformly sample $k \in \{0 \dots n\}$, then uniformly sample $a_{1 \dots n} \in \{0,1\}^n$ under the constraint that $\sum{a_i}=k$. The auxiliary number $k$ is ignored from the final result.
For example, with $n=2$, the pmf would be $P(00)=1/3, P(01)=P(10)=1/6, P(11)=1/3$. In another word, it's just uniformly random bits with "flattened" outcome distribution that is otherwise binomial.
The naive method is to uniformly sample $k$, let $a=\{1\}^k\{0\}^{n-k}$, then randomly permute it, but the sampling of random permutation seems cumbersome and weird for the task of generating bits.
I would like to ask: 1) if there's a more efficient, coin-tossing-like sampling algorithm that doesn't involve permutations; 2) or more generally, if there's an established mathematical concept for the "flattening" of distributions described above.