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.
Find common elements in matrix rows
1237 Solvers
280 Solvers
Convert a vector into a number
503 Solvers
Find the index of the largest value in any vector X=[4,3,4,5,9,12,0,4.....5]
298 Solvers
Back to Basics - Find no. of elements in a matrix?
216 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!