1.? Scrambling algorithm 1:
Correctness:? It can be proved by "lottery fairness"
2.? Interrupt algorithm 2:
Correctness:
Assuming that after the for loop executes step k, the first k prime numbers have been randomly scrambled correctly, that is, for any of the first k elements of the original array, the probability that they are now in a[i], i ∈ [0, k-1/k is1], then the for loop executes step k+/kloc-. Because, from the operation of step k+ 1, it is easy to know that for k+ 1 element, it appears in [0...k] is 1/(k+ 1), and for the first k elements, it passes through k+/kloc-0. (k+1)) =1(k+1), and the probability that it appears at k position is1(k+1), so for the first k elements, its appearance at [0...k] is.