Shuffle

(shuffle vector) -> vector
(shuffle list) -> list

This is a Fisher-Yates Shuffle, also referred to as a Knuth shuffle. It randomizes the order of elements of a list or vector.

Given a vector, shuffle is destructive. Given a list, a new, altered instance of the list is created.

Examples:

>> (shuffle a)
:: (4 1 5 2 3)
>> a
:: (1 2 3 4 5)
>> (shuffle b)
:: [vector 2 1 4 3 5]
>> b
:: [vector 2 1 4 3 5]