MATLAB: Create random permutations of an array of decimals or a vector of decimals.

decimalspermutation

If i have the following vector [0;0.25;0.75;0.5], how i can create 2 or 3 or n permutations? I cannot use randperm, because works only with integers. Thank you in advance!

Best Answer

N = 3;
v = [0;0.25;0.75;0.5];
[~, idx] = sort(rand(N, length(v)), 2);
permuted_v = v(idx);