Cody

Problem 44277. Given n, create n random numbers such that their standard deviation is also n.

Solution 3042235

Submitted on 3 Oct 2020 by Abhijeet Deshmukh
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
x = 10; assert(length(randpro(x))==10) assert(std(randpro(x))>9) assert(std(randpro(x))<11)

y = -7.5918 16.3124 -8.6561 3.2220 -10.2553 -7.1901 10.4520 -0.9873 -7.4384 17.7903 ans = 10.7742 y = -0.2362 10.1728 12.6423 0.0631 1.5287 -1.3895 -6.3006 -24.2688 -4.4340 18.5706 ans = 11.8172 y = 10.8772 -6.6484 6.6832 -6.4070 12.2962 -8.9622 0.4684 9.8839 12.6634 15.9785 ans = 9.2736

2   Pass
x = 17; assert(length(randpro(x))==17) assert(std(randpro(x))>16) assert(std(randpro(x))<18)

y = -10.3565 -0.9948 -25.4687 -7.2608 11.0565 4.4593 -10.9345 42.5886 19.6294 -3.7626 -0.6866 3.4203 -4.1984 27.2459 29.2168 13.8207 7.1108 ans = 16.9969 y = 25.6492 8.4702 -27.8979 -11.0510 12.5924 15.9927 6.2756 -25.0337 1.0929 -31.0562 21.7908 5.7668 26.1837 20.4181 -13.5034 -31.3378 14.7932 ans = 20.3844 y = 0.6533 -11.7474 -9.2943 -3.9462 15.2039 4.4430 20.3937 7.6530 19.2116 -16.8589 14.3830 5.9844 12.5923 -11.1996 23.3827 11.6790 -6.3786 ans = 12.5709

Suggested Problems

More from this Author100

Community Treasure Hunt

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

Start Hunting!