Cody

# Problem 44272. Generate one sample of uniform random numbers between -pi and +pi

Solution 1947698

Submitted on 24 Sep 2019
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   Fail
w=0; for k=1:10^3 w=w+rndpi(1); end assert(w<1000)

low = -3.1416 high = 3.1416

Error using randi First input must be a positive scalar integer value IMAX, or two integer values [IMIN IMAX] with IMIN less than or equal to IMAX. Error in rndpi (line 4) y =randi([low high],1,10) Error in Test1 (line 3) w=w+rndpi(1);

2   Fail
w=0; for k=1:10^3 w=w+rndpi(1)^2; end assert(w>10^3)

low = -3.1416 high = 3.1416

Error using randi First input must be a positive scalar integer value IMAX, or two integer values [IMIN IMAX] with IMIN less than or equal to IMAX. Error in rndpi (line 4) y =randi([low high],1,10) Error in Test2 (line 3) w=w+rndpi(1)^2;

3   Fail
w=0; for k=1:10^3 w=min(w,rndpi(1)); end assert(w<-pi*0.9) assert(w>-pi*1.1)

low = -3.1416 high = 3.1416

Error using randi First input must be a positive scalar integer value IMAX, or two integer values [IMIN IMAX] with IMIN less than or equal to IMAX. Error in rndpi (line 4) y =randi([low high],1,10) Error in Test3 (line 3) w=min(w,rndpi(1));