Cody

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

Solution 2056553

Submitted on 13 Dec 2019 by Martin Joska
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)

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