Why does Sattolo's algorithm produce a permutation with exactly one cycle?
https://danluu.com/sattolo/ [danluu.com]
2017-08-12 04:13
I recently had a problem where part of the solution was to do a series of pointer accesses that would walk around a chunk of memory in pseudo-random order. Sattolo’s algorithm provides a solution to this because it produces a permutation of a list with exactly one cycle, which guarantees that we will reach every element of the list even though we’re traversing it in random order
source: danluu