Armstrong教授建议用下面的过程来产生一个均匀随机排列:
PERMUTE-BY-CYCLIC(A) 1 n=A.length 2 let B[1...n]be a new array 3 offset = RANDOM(1,n) 4 for i=1 to n 5 dest = i + offset 6 if dest>n 7 dest = dest-n 8 B[dest]=A[i] 9 return B
请说明每个元素A[i]出现在B中任何特定位置的概率是1/n。然后通过说明排列结果不是均匀随机排列,表明Armstrong教授错了。