Algorithm: Knuth Shuffle: ・In iteration i, pick integer r between 0 and i uniformly at random. ・Swap a[i] and a[r].Complexity: Knuth shuffling algorithm produces a uniformly random permutation of the input array in linear time.
转载请注明原文地址:https://ipadbbs.8miu.com/read-4763.html