If you call sort on a simple array of strings or numbers it will sort them alphabetically or numerically. Also, if you pass in an optional anonymous function parameter you can custom sort the array as long as your function returns a negative, zero or positive value.
A simple way of randomly sorting a simple array of numbers is
but this is the least efficient and biased way of sorting randomly as it has a strong bias toward keeping each element in its initial starting position in addition to the edges of the array having slightly more bias than the middle.
Random Shuffling An Array the Fisher-Yates (aka Knuth) Way
Originally designed by Fisher and Yates as pencil and paper method using a table of random numbers for randomness and then popularized by Donald E. Knuth in The Art of Computer Programming (source). This shuffling algorithm provides with a more efficient and more random result set.