I came across this sorting algorithm the other day called 'bogo sort'. This is a sort of joke sorting algorithm that is highly ineffective at actually sorting arrays. The name comes from the word 'bogus'.
Here is how it works.
- Take an array.
- Shuffle it.
- If the array sorted then stop.
- If the array is not sorted then return to step 2.
As you can see, this isn't so much a sorting algorithm, more of a game of chance. Due to the random nature of the sort you might need to wait a very long time before the array is actually sorted.
Here is an implementation of a bogo sort in PHP.