Had to implement a sorting algorithm today for the first time in my entire career, so i guess finally learning about them decades ago paid off

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

Screw you computer science, computer go brrr.

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 i love that i once again have access to short form "lol computers" content.

@Pwnallthethings how hard can sorting be anyway??

*checks notes* oh... oh no.

@Pwnallthethings that's why I only ever work with custom standard library implementations that specifically target the hardware I'm building against.
Intel Publishes Blazing Fast AVX-512 Sorting Library, Numpy Switching To It For 10~17x Faster Sorts

Intel recently published an open-source C++ header file library for high performance SIMD-based sorting, which initially is focused on providing a lightning fast AVX-512 quicksort implementation

@Pwnallthethings With some minor tweaks you can transform your algorithm into the best sort: Quantum Bogosort!

http://wiki.c2.com/?QuantumBogoSort

@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.