encryptMyWaltz - % set state of random generator to...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
function sdata = encryptMyWaltz(dat) f % Scramble the order of the structures in the structure array dat based on % Matlab's random number generator given a state (seed) value. Use an % input statement to prompt the user for the state value. % stateval = input('Please enter in state (seed) value:') s rand('state',stateval)
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: % set state of random generator to inputted value r [x idx] = sort(rand(32,1)); % x is sorted vector of random elements, idx % is index vector for j = 1 : length(idx) sdata(j) = dat(idx(j)); % each element of sdata gets a random element % of dat such that none is repeated end e...
View Full Document

Ask a homework question - tutors are online