If set $x$ has $t$ elements, the objective is to obtain each of the $t!$
pemutations with equal probability, especially when $t$ is large. To
achieve this goal we use backward Knuth's shuffling, which is based on
the Fisher-Yates shuffle.

shuffling has been introduced as an alternative to MATLAB function
randperm. Randperm makes a call to sort(rand(1,n)) and, overall, is
slower than shuffling (for example, in R2009a shuffling was on average
25 faster). If compiled as mex file, shuffling becomes much more
efficient than x(randperm(numel(x))) solution (it is about 60 faster for
n=10^6). C code that can be used for this purpose is available at the
http://it.mathworks.com/matlabcentral/fileexchange/27076-shuffle website
as part of Jan Simon's Shuffle library.