Shuffle

    技术2022-07-10  143

    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.
    Processed: 0.008, SQL: 9