Sattolo cycle

Modifies the array in-place:

func sattolo_cycle(arr) {
    for i in (arr.len ^.. 1) {
        arr.swap(i, pick(^i))
    }
}

Last updated