Shuffling algorithm Algorithms (random scrambling algorithm)

Sorting algorithm for a sequence become orderly, and shuffling algorithm is used to play a sequence of "chaos", it can be considered the opposite sorting algorithm. With the random number shuffling algorithm needs to achieve to fight "chaos" sequence.

Shuffling algorithm correctness criterion ( "chaos" judgment basis): for a sequence comprising n elements, which are arranged all-n possible, so if a scrambled sequence shuffling algorithm! Different results have n! kind of the algorithm is correct shuffling algorithm. If the results may upset several of the ratio n! Large, then the greater the probability of occurrence of some circumstances.

 

See: https://github.com/labuladong/fucking-algorithm/blob/master/ algorithm thinking Series / shuffling algorithm .md

Guess you like

Origin www.cnblogs.com/z-sm/p/12393211.html