Cody

# Problem 174. Roll the Dice!

Solution 420167

Submitted on 19 Mar 2014 by Margreet
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
%% x1 = zeros(1,6000); x2 = zeros(1,6000); for ii = 1:6000 [x1(ii),x2(ii)] = rollDice(); end numCt = sum( bsxfun( @eq, x1, (1:6)' ), 2 ) + sum( bsxfun( @eq, x2, (1:6)' ), 2 ); assert(all(round(numCt/200) == 10) && sum(numCt) == 12000)

a = 2 1 x2 = 1 a = 6 1 x2 = 1 a = 3 6 x2 = 6 a = 4 5 x2 = 5 a = 2 4 x2 = 4 a = 5 1 x2 = 1 a = 1 3 x2 = 3 a = 3 3 x2 = 3 a = 2 4 x2 = 4 a = 2 5 x2 = 5 a = 3 3 x2 = 3 a = 3 2 x2 = 2 a = 4 5 x2 = 5 a = 2 1 x2 = 1 a = 1 1 x2 = 1 a = 5 5 x2 = 5 a = 4 1 x2 = 1 a = 1 4 x2 = 4 a = 4 6 x2 = 6 a = 4 3 x2 = 3 a = 1 4 x2 = 4 a = 2 2 x2 = 2 a = 3 1 x2 = 1 a = 5 4 x2 = 4 a = 3 2 x2 = 2 a = 4 5 x2 = 5 a = 1 5 x2 = 5 a = 1 6 x2 = 6 a = 1 5 x2 = 5 a = 4 3 x2 = 3 a = 4 6 x2 = 6 a = 1 2 x2 = 2 a = 6 3 x2 = 3 a = 2 1 x2 = 1 a = 2 1 x2 = 1 a = 2 6 x2 = 6 a = 5 3 x2 = 3 a = 1 3 x2 = 3 a = 3 6 x2 = 6 a = 1 1 x2 = 1 a = 3 3 x2 = 3 a = 6 3 x2 = 3 a = 4 4 x2 = 4 a = 2 1 x2 = 1 a = 3 3 x2 = 3 a = 3 5 x2 = 5 a = 4 3 x2 = 3 a = 4 6 x2 = 6 a = 2 4 x2 = 4 a = 6 6 x2 = 6 a = 2 2 x2 = 2 a = 2 6 x2 = 6 a = 1 1 x2 = 1 a = 3 6 x2 = 6 a = 2 3 x2 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 4 2 x2 = 2 a = 2 6 x2 = 6 a = 2 3 x2 = 3 a = 3 1 x2 = 1 a = 3 5 x2 = 5 a = 3 1 x2 = 1 a = 1 5 x2 = 5 a = 6 3 x2 = 3 a = 4 2 x2 = 2 a = 3 2 x2 = 2 a = 6 2 x2 = 2 a = 2 4 x2 = 4 a = 3 1 x2 = 1 a = 1 5 x2 = 5 a = 3 3 x2 = 3 a = 1 6 x2 = 6 a = 6 2 x2 = 2 a = 1 1 x2 = 1 a = 4 6 x2 = 6 a = 4 5 x2 = 5 a = 4 1 x2 = 1 a = 1 2 x2 = 2 a = 6 4 x2 = 4 a = 6 5 x2 = 5 a = 4 6 x2 = 6 a = 4 3 x2 = 3 a = 3 1 x2 = 1 a = 6 4 x2 = 4 a = 6 4 x2 = 4 a = 6 4 x2 = 4 a = 1 5 x2 = 5 a = 6 5 x2 = 5 a = 1 4 x2 = 4 a = 4 4 x2 = 4 a = 6 4 x2 = 4 a = 4 4 x2 = 4 a = 1 3 x2 = 3 a = 4 6 x2 = 6 a = 3 4 x2 = 4 a = 2 5 x2 = 5 a = 5 6 x2 = 6 a = 5 5 x2 = 5 a = 6 4 x2 = 4 a = 3 4 x2 = 4 a = 4 2 x2 = 2 a = 6 2 x2 = 2 a = 1 4 x2 = 4 a = 5 6 x2 = 6 a = 5 4 x2 = 4 a = 3 1 x2 = 1 a = 4 6 x2 = 6 a = 6 3 x2 = 3 a = 5 5 x2 = 5 a = 4 5 x2 = 5 a = 1 6 x2 = 6 a = 1 6 x2 = 6 a = 6 4 x2 = 4 a = 1 1 x2 = 1 a = 4 1 x2 = 1 a = 3 5 x2 = 5 a = 1 5 x2 = 5 a = 1 6 x2 = 6 a = 4 2 x2 = 2 a = 3 4 x2 = 4 a = 2 5 x2 = 5 a = 3 1 x2 = 1 a = 1 5 x2 = 5 a = 4 1 x2 = 1 a = 2 1 x2 = 1 a = 1 6 x2 = 6 a = 6 3 x2 = ...

### Community Treasure Hunt

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

Start Hunting!