Unfortunately since then, I've also learned about test-driven development, and forgotten everything I learned back then. So just went with
1. First implement a test routine "IsSorted(list)" to check the algorithm is right
Sort(list):
While(!IsSorted(list))
SwapRandomEntries(list);
return
Also fun fact, qsort() in your libc is likely only *sometimes* quicksort. And it's not quicksort based on a threshold that made sense for a Sun machine.
Anyway, in summary, lol computers
@Pwnallthethings how hard can sorting be anyway??
*checks notes* oh... oh no.
@Pwnallthethings With some minor tweaks you can transform your algorithm into the best sort: Quantum Bogosort!
@Wlm @Pwnallthethings
In the infinite multiverse, each one of us lives forever in at least one universe.
So my mission is simply to destroy all the universes where I don't live forever.
@coreyrayburnyung @Pwnallthethings @SteveBellovin
And when quantum computing comes of age we'll just throw bits around randomly and rely on at least *one* reality getting it 'right'.
That'll be my excuse.