MATLAB: Random permutation of 3 numbers when repetition of digits are allowed

random permutation

I want to have random permutation of 3 numbers when repetition of digits are allowed.in 3 matrix 1*3 , How can i have them in matrix?Am i supposed to program it or not?
Regards

Best Answer

Try it this way,
a=[1 2 3];
b=[a(ceil(3*rand(1))) a(ceil(3*rand(1))) a(ceil(3*rand(1)))];
Now each entry in b will be a random entry in a, with repetitions allowed