thanks for the clue at description
vec = randperm(n);
This solution seems to run correctly in MATLAB (desktop)... can anyone tell me why it is coming back with an "Assertion Failed"?
function vec = makeRandomOrdering(n)
vec = zeros(1, numel(n));
flags = zeros(1, numel(n));
index = 1;
while (sum(flags) ~= numel(n))
pos = randi(numel(n));
if (flags(pos) ~= 1)
vec(index) = n(pos);
index = index + 1;
flags(pos) = 1;
end
end
end
Remove all the words that end with "ain"
1303 Solvers
Given an unsigned integer x, find the largest y by rearranging the bits in x
795 Solvers
How many trades represent all the profit?
526 Solvers
Rounding off numbers to n decimals
1077 Solvers
What is Sum Of all elements of Matrix
297 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!