Problem 44031. Matrix Manipulation
The test suite of this problem has been updated to actually check for numbers in the specified range (between 3 to 15), so your random solutions should now work.
Any chance you could make the test suite see if the numbers are actually random? :-)
It's actually quite a difficult thing to do well. See for example Problem 44393 at https://www.mathworks.com/matlabcentral/cody/problems/44393 , which so far has only one solver (in addition to my reference solution). Cf. the Test Suites in Problem 174 by Bryant Tran and Problem 44277 by Amitava Biswas. —DIV
(Here it's a little easier because the author can repeatedly call the user's function with the same input, and check for variation in the returned output.)
David, that's kind of what I meant by checking to see if the output was random. Run the code maybe 10-15 times, and see if the values are different each time would be "random enough" for Cody.
If the test suite did check for the values being random, then this solution wouldn't have worked.
Problem Recent Solvers33
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!