Cody

Problem 641. Make a random, non-repeating vector.

Solution 1186931

Submitted on 12 May 2017 by Augusto Mazzei
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
n = 10; flagSame = isequal(makeRandomOrdering(n), makeRandomOrdering(n)); flagAllUsed = isequal([1:n],sort(makeRandomOrdering(n))); assert(~flagSame & flagAllUsed)

vec = 9 2 4 6 10 5 8 1 7 3 vec = 9 7 10 5 2 1 6 8 4 3 vec = 6 10 8 3 7 4 9 2 1 5

Suggested Problems

More from this Author52

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!