Cody

Solution 2052604

Submitted on 9 Dec 2019 by Pauli Huusari
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)

y = Columns 1 through 30 1 26 20 25 14 22 12 23 16 10 10 14 7 10 14 25 23 24 18 24 8 20 3 12 12 19 2 15 26 26 Columns 31 through 60 21 13 1 17 21 22 12 1 8 13 23 18 1 16 13 9 1 12 6 13 26 8 25 24 13 18 14 9 6 9 Columns 61 through 90 20 13 10 4 25 6 11 20 23 2 13 10 23 9 14 14 16 1 14 21 13 20 3 8 21 8 17 21 20 4 Columns 91 through 120 1 26 22 5 19 21 16 7 5 11 26 7 11 12 13 13 17 14 8 23 6 8 6 16 16 14 25 10 1 19 Columns 121 through 150 11 4 17 13 11 14 5 11 3 18 11 19 8 23 12 21 4 11 18 21 25 9 15 8 7 19 20 24 6 8 Columns 151 through 180 21 4 11 5 9 14 24 17 10 20 18 20 15 15 3 14 1 23 5 2 11 14 5 9 15 22 23 14 19 4 Columns 181 through 210 14 15 14 13 5 19 25 4 24 9 1 6 5 21 12 14 21 21 16 22 14 20 26 5 23 6 14 12 16 6 Columns 211 through 240 21 24 23 13 17 16 16 11 13 6 5 12 24 15 19 23 9 6 19 3 26 8 8 4 26 10 12 23 16 18 Columns 241 through 270 8 11 22 5 23 7 18 14 15 19 22 16 11 2 26 17 20 18 5 2 16 17 12 12 2 17 26 4 18 25 Columns 271 through 300 15 7 8 17 22 16 26 2 9 12 23 19 13 4 10 21 7 23 24 20 19 5 26 1 4 15 8 5 24 18 Columns 301 through 330 24 6 18 6 3 11 7 12 13 2 14 15 1 16 19 26 1 10 15 21 9 15 23 7 8 15 19 15 21 22 Columns 331 through 360 24 13 24 18 1 19 7 5 22 21 17 7 22 8 13 3 26 6 11 4 18 14 26 1 14 3 25 2 22 26 Column 361 3

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)

y = Columns 1 through 30 1 2 2 2 1 1 1 2 1 1 2 2 1 1 2 1 1 2 1 1 1 2 1 2 1 1 1 2 2 2 Columns 31 through 60 2 2 1 1 2 2 1 2 1 2 1 1 2 2 2 1 1 2 2 2 1 2 2 1 1 1 2 1 2 2 Columns 61 through 90 1 2 1 1 2 2 2 1 2 1 2 1 2 2 2 2 2 1 1 1 1 1 2 1 1 1 2 1 2 2 Columns 91 through 120 1 2 2 1 1 2 1 1 2 1 1 2 2 2 1 1 1 2 2 2 2 1 1 1 1 2 1 2 2 1 Columns 121 through 150 1 1 1 1 1 2 2 1 1 2 2 1 1 1 1 1 1 2 2 2 1 1 1 1 2 2 2 1 1 2 Columns 151 through 180 1 1 1 1 1 1 2 2 1 2 2 2 2 1 2 1 1 1 1 1 2 1 1 1 2 2 2 1 1 1 Columns 181 through 210 2 1 1 2 1 2 2 1 1 1 1 1 1 1 2 1 1 1 1 1 2 2 1 1 1 2 1 2 2 2 Columns 211 through 240 2 2 1 1 1 2 2 2 2 2 1 1 2 2 2 1 2 1 2 2 2 2 2 2 2 1 2 2 1 1 Columns 241 through 270 2 2 2 1 2 2 1 2 1 2 2 2 1 1 1 1 1 1 2 2 2 2 1 1 2 1 2 2 2 1 Columns 271 through 300 1 1 1 1 2 2 2 1 1 1 1 1 1 1 2 2 2 2 1 2 2 1 2 2 1 2 1 1 2 1 Columns 301 through 330 2 1 1 2 2 2 2 1 1 1 1 2 2 2 2 1 2 2 1 2 1 2 2 2 1 2 2 2 2 2 Columns 331 through 360 1 1 1 1 1 1 2 2 2 2 1 1 1 2 2 2 2 2 1 1 1 2 1 1 2 1 1 2 1 1 Columns 361 through 390 1 1 2 1 2 2 1 1 1 1 1 2 1 2 2 2 1 1 2 1 2 2 2 1 2 2 1 2 2 1 Columns 391 through 420 1 2 1 1 1 1 2 2 2 1 2 2 1 2 1 2 2 2 1 2 1 1 1 1 2 1 2 1 1 1 Columns 421 through 450 1 1 1 2 2 1 2 2 2 1 2 1 1 2 1 1 2 2 1 2 1 1 1 1 1 2 2 2 1 2 Columns 451 through 480 2 1 2 1 1 1 1 1 2 1 1 2 2 1 2 2 1 2 1 2 2 1 2 1 2 2 2 2 2 2 Columns 481 through 510 1 1 2 1 2 1 2 2 2 1 2 1 2 1 1 1 2 1 2 1 2 2 2 1 1 2 2 2 2 2 Columns 511 through 540 2 1 2 2 1 1 1 1 1 2 1 2 2 1 2 2 1 1 1 2 2 2 2 2 2 2 2 2 2 2 Columns 541 through 570 2 1 1 2 1 2 2 2 1 2 2 1 1 1 1 2 1 1 2 1 1 1 2 2 2 1 2 2 1 2 Columns 571 through 600 1 1 2 2 2 2 1 1 2 1 1 2 2 2 2 1 1 1 2 1 1 2 1 1 1 1 2 2 1 1 Columns 601 through 630 1 1 2 1 1 2 1 2 1 2 2 1 2 1 1 2 2 1 1 1 2 1 1 1 1 1 2 2 1 1 Columns 631 through 660 2 1 1 2 1 2 2 1 2 2 1 2 1 2 1 1 1 1 2 1 2 1 2 2 1 2 2 1 1 1 Columns 661 through 673 1 2 2 2 1 1 1 2 1 2 1 2 0

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)

y = Columns 1 through 15 1 1000 938 733 823 639 437 621 398 482 773 155 649 924 211 Columns 16 through 30 547 6 352 298 844 627 270 360 608 905 97 913 479 826 342 Columns 31 through 45 538 128 132 527 772 887 322 438 811 201 960 563 846 951 308 Columns 46 through 60 281 220 693 85 228 807 705 924 126 266 289 929 902 86 709 Columns 61 through 75 586 963 958 317 633 500 814 291 910 985 117 4 395 916 312 Columns 76 through 90 735 161 900 722 391 244 923 605 728 201 317 587 170 54 293 Columns 91 through 105 255 924 136 956 690 869 781 81 579 204 1 506 194 59 261 Columns 106 through 120 23 72 667 682 288 556 776 931 532 537 159 286 662 865 912 Columns 121 through 135 173 669 97 801 5 271 272 220 814 261 551 535 330 607 533 Columns 136 through 150 607 201 910 183 461 32 703 844 867 61 817 255 483 508 98 Columns 151 through 165 578 557 991 219 317 410 272 44 379 153 223 449 836 583 862 Columns 166 through 180 484 683 128 950 971 843 702 165 610 691 749 636 863 438 492 Columns 181 through 194 928 807 634 810 459 394 586 773 101 494 767 704 623 405

Suggested Problems

More from this Author31