MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi
Opportunities for recent engineering grads.
Problem 174. Roll the Dice!
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.
2 players like this solution
x1 = zeros(1,6000);
x2 = zeros(1,6000);
for ii = 1:6000
[x1(ii),x2(ii)] = rollDice();
numCt = sum( bsxfun( @eq, x1, (1:6)' ), 2 ) + sum( bsxfun( @eq, x2, (1:6)' ), 2 );
assert(all(round(numCt/200) == 10) && sum(numCt) == 12000)