0

Given a set of $N$ elements and a uniformly distributed random number generator, which always generates values between $0$ and $N-1$. Then the probability to get a random permutation (without re-draws) is given by:

$$p_{0, right} = \prod_{i = 1}^{N-1} \frac{N-i}{N}$$

The $0$ indicates no re-draw. For the example N = 4, this results in following:

$$p_{0, right} = \frac{3}{4} \cdot \frac{2}{4} \cdot \frac{1}{4} = 0.09375$$

If we are allowed, to re-draw once, then the probability increases. Re-drawing can happen at any position. For the given example above, we can re-draw at three different positions. If we re-draw at the first position, the probability for that is given by:

$$p_{1} = \left( \frac{3}{4} + \frac{1}{4} \cdot \frac{3}{4} \right) \cdot \frac{2}{4} \cdot \frac{1}{4}$$

This is repeated for all other re-draw positions, to get $p_{2,3}$. The probability to get a random permutation with maximum 1 re-draw is then given by

$$p_{1, right} = p_{0, right} + p_1 + p_2 + p_3$$

My question no is how to generalize this for to $k$ re-draws?

joriki
  • 238,052

1 Answers1

0

Your probability isn't right because you're overcounting the cases where you don't have to redraw; they're counted in all four of your terms.

A simpler approach to this: The probability $p(N,k)$ of getting a permutation of $N$ elements allowing $k$ redraws is the probability of getting all $N$ elements in $N+k$ draws. This corresponds to the probability distribution of the coupon collector's problem for $N$ coupon types, which is given e.g. here; see also here and here. Thus

$$ p(N,k)=\frac{N!}{N^{N+k}}\left\{N+k\atop N\right\}=\frac1{N^{N+k}}\sum_{j=0}^N(-1)^{N-j}\binom Njj^{N+k}\;. $$

joriki
  • 238,052