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

@Pwnallthethings it's not even guaranteed to terminate!
@vance_maverick but when it does, it's right
@Pwnallthethings @vance_maverick *IF* it does 😂
@davidbruchmann @Pwnallthethings right, you have to make assumptions about SwapRandomEntries to even demonstrate that the probability of termination converges on 1