Hello! I am trying to randomly choose one element from a string for a predifined number of times but I don't know how I can avoid getting the same element more than once.. Beneath is the code I wrote (my question may be more comprehensible through the comment in the code).
%% ************************************ *******************************************
letters = 'ABCD';
ntrials = 3;
nletters = 4;
for i = 2: ntrials
for j = 1: nletters *% it needs to display a random letter from letters but the same
% letter must NOT appear more than once in this nested loop.*
endend
% ******************************* end of code ************************************************
output example: BCAD ADCB
Thanks a lot!
Best Answer