Cody

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

Solution 2099128

Submitted on 20 Jan 2020 by Nurdos Omarkulov
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 = 6 2 3 5 1 8 4 10 9 7 ans = 6 9 5 8 2 7 10 1 4 3 ans = 8 4 3 2 6 7 10 9 5 1

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!