Cody

Solution 172882

Submitted on 5 Dec 2012 by J.R.! Menzinger
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
%% nocheat = isempty(regexp(evalc('type random_sequence'),'([^f]eval|regexprep|inline|str2func)')); m = 26; s = 5000; y = random_sequence(m,s); assert(isequal(sum(y),s) && abs(mean(y)-m/2)<m*sqrt(m/s)+1/2 && isequal(y,round(y)) && abs(std(y)-m/sqrt(12))*sqrt(s)/m<2.5 && nocheat)

[Warning: Size vector should be a row vector with integer elements.] [> In random_sequence at 3 In verifyCode>evaluateCode at 226 In verifyCode at 40 In fevalJSON at 14] ans = 20 24 17 20 12 8 19 12 5 2 14 15 22 6 2 8 15 24 6 24 18 22 23 6 5 15 14 11 26 16 20 1 8 24 23 21 25 7 7 25 21 15 21 26 25 14 24 6 20 11 14 2 3 7 25 17 23 12 6 12 7 9 2 2 1 11 14 19 1 7 20 1 13 13 9 25 7 12 7 19 22 21 24 9 12 11 3 26 20 21 16 15 3 23 2 23 5 17 15 26 24 1 1 7 26 22 13 17 21 8 12 12 24 26 21 12 6 5 3 7 17 22 26 9 4 9 10 6 15 24 2 15 3 12 7 11 1 5 11 12 20 12 17 6 22 16 25 16 22 11 9 22 22 13 13 25 26 10 14 25 23 17 3 18 24 16 8 8 5 24 19 24 8 13 4 22 14 5 4 10 24 25 16 8 21 26 9 4 18 11 15 23 12 19 2 15 22 17 26 7 15 11 20 5 18 6 1 8 9 6 16 9 12 11 23 25 4 8 10 4 10 25 21 1 17 25 16 26 10 18 22 16 7 13 7 23 3 17 19 2 22 13 15 4 26 24 7 15 8 24 6 3 21 17 26 10 10 15 5 14 26 26 15 21 13 24 7 22 2 24 7 6 22 2 17 1 18 4 9 11 11 8 25 11 12 14 24 26 3 26 3 14 15 17 20 23 8 10 11 15 21 13 2 11 1 4 12 25 10 14 2 9 4 12 23 7 2 3 1 25 19 6 10 16 14 22 2 4 11 1 8 15 18 9 7 26 25 25 25 17 23 20 8 3 11 15 20 2 9 22 2 10 11 9 21 19 17 4 19 25 23 5 9 2

2   Pass
%% nocheat = isempty(regexp(evalc('type random_sequence'),'([^f]eval|regexprep|inline|str2func)')); m = 2; s = 1000; y = random_sequence(m,s); assert(isequal(sum(y),s) && abs(mean(y)-m/2)<m*sqrt(m/s)+1/2 && isequal(y,round(y)) && abs(std(y)-m/sqrt(12))*sqrt(s)/m<2.5 && nocheat)

ans = 2 1 1 1 1 1 1 2 2 2 1 1 2 1 2 2 1 1 1 2 2 1 2 2 1 1 2 2 2 1 2 2 2 2 2 2 2 2 1 1 2 2 2 1 1 2 2 2 2 2 2 2 1 1 2 2 1 1 1 2 2 1 2 1 2 2 1 2 1 1 1 2 1 2 1 2 2 2 2 2 1 2 2 2 1 1 2 1 1 1 2 2 2 2 2 2 2 1 1 1 1 2 1 2 1 1 1 2 2 2 1 2 2 1 2 2 1 2 1 1 1 1 2 1 2 1 1 2 2 2 2 2 1 1 2 1 2 1 1 1 2 1 1 1 1 1 1 2 2 2 2 1 2 2 2 2 2 1 1 2 1 2 1 1 2 2 2 2 1 2 2 2 2 2 1 1 2 1 2 1 1 2 1 2 2 2 2 1 2 2 2 1 2 1 1 2 1 2 2 2 1 1 2 1 2 2 1 2 2 1 2 1 1 1 1 2 2 1 2 2 2 1 1 2 1 1 1 1 2 2 1 2 1 2 1 2 2 2 1 1 1 1 1 1 1 1 2 2 1 1 1 1 1 2 1 1 1 1 2 1 2 1 1 1 2 2 1 2 2 1 2 1 1 1 1 1 2 1 1 1 2 2 2 1 1 2 1 2 1 1 1 2 1 1 2 1 1 2 2 1 1 2 1 1 1 1 2 2 1 1 2 1 2 2 2 2 1 2 2 1 1 1 1 1 2 1 1 2 2 2 1 1 2 1 1 2 1 2 2 2 1 2 2 2 2 1 1 2 1 1 1 1 2 2 2 2 2 2 1 2 2 2 1 1 1 1 1 2 1 1 1 1 1 1 1 1 2 1 2 1 1 2 1 1 2 2 2 2 2 2 1 2 2 1 1 2 2 1 2 1 2 1 2 2 2 1 2 2 1 2 1 1 2 2 2 1 2 2 1 1 2 2 2 1 1 2 2 1 1 1 1 1 1 1 1 1 1 1 2 2 1 1 1 2 2 2 2 1 2 2 1 2 1 2 1 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 2 1 1 1 2 1 1 1 1 2 2 2 2 2 1 2 1 1 1 1 2 2 2 2 2 1 1 2 2 1 2 1 1 2 1 1 2 1 1 1 2 2 2 2 1 1 2 2 1 2 1 1 2 2 1 2 2 2 2 1 1 1 2 2 2 1 1 1 2 2 1 1 1 1 1 1 1 2 2 1 1 1 2 2 2 1 1 2 1 1 1 1 1 2 1 2 1 1 1 2 2 1 2 2 2 2 1 2 1 1 2 1 2 1 2 2 1 1 2 1 1 1 1 1 2 2 1 2 1 1 2 2 2 2 2 2 2 2 2 2 1 1 2 1 2 1 2 1 1 1 1 1 2 1 1 1 2 1 1 1 2 1 2 1 1 1 1 1 2 2 2 2 2 1 1 2 1 1 1 2 2 1 1 2 1 1 2 1 1 2 1 1 1 1 2 1 2 2 1 1 2 1

3   Pass
%% nocheat = isempty(regexp(evalc('type random_sequence'),'([^f]eval|regexprep|inline|str2func)')); m = 1000; s = 100000; y = random_sequence(m,s); assert(isequal(sum(y),s) && abs(mean(y)-m/2)<m*sqrt(m/s)+1/2 && isequal(y,round(y)) && abs(std(y)-m/sqrt(12))*sqrt(s^1/m^3)<1 && nocheat)

ans = 414 653 7 580 395 545 294 758 526 785 316 645 613 610 59 163 480 995 566 525 20 353 689 579 368 859 907 589 714 206 7 716 467 11 189 130 518 183 188 982 246 592 82 596 595 556 624 390 943 800 887 238 690 52 217 938 447 809 510 918 38 926 213 955 525 804 384 131 103 942 654 155 941 740 992 616 233 718 537 509 186 81 467 135 97 843 745 168 615 442 303 94 996 207 41 662 82 208 123 33 500 710 901 707 169 173 904 919 355 81 402 100 243 524 449 672 500 6 392 648 931 302 765 588 464 664 191 168 826 125 477 943 757 736 214 618 957 144 314 272 902 565 673 24 976 151 358 713 65 80 392 488 205 53 430 73 182 948 749 356 766 222 487 68 486 180 650 576 820 411 379 869 189 488 918 619 322 568 899 612 976 244 765 178 354 94 19 252 929 33 829 552 763 704 124 849 63 780 658 760 369 158 638 757 570 462 679 340