Bogosort, also known as "Stupid Sort" or "Monkey Sort", is an extremely inefficient sorting
algorithm. It works by randomly shuffling the given list, then verifying whether or not it is sorted. If the list is not sorted, it randomly shuffles it
repeatedly until it is sorted. This is really horrible.
You can imagine this algorithm using a metaphor. Imagine holding a deck of cards that you want to arrange into sorted order. Using Bogosort would be like
dumping all the cards onto the floor, picking them up randomly, and checking if the deck is now sorted. If not, you'd dump the cards onto the floor again until it is.
The algorithm has an average runtime of O(n*n!), which is basically appalling. Hypothetically, no matter how long the list passed into Bogosort is,
it may never actually end up sorted due to its random nature.
Bogosort is utterly useless as an actual sorting algorithm, but it makes for a fun joke and is useful instructional material for students learning algorithms as it
can be compared to much more efficient sorting methods.
The Timeout variable determines how many times the Bogosort algorithm will be allowed to loop before
it is forced to stop. The default is 10000000 (ten million), which is enough to fairly reliably sort a list of 10 items or less. (Bogosort is random, so
even lists of less than 10 items might reach the default timeout.)
Adjusting the timeout will allow you to process longer lists, but be aware that the runtime will increase exponentially with the list size. It could become
stupidly long very quickly.
IMPORTANT: Note that the algorithm can gobble up your system resources or even crash the browser if you try to process very long lists. Tinker with the runtime
at your own risk.