Please do 12Solution clc clear Input data and set constant
Please do #12
Solution
clc, clear;
%% Input data and set constant
time = 2.5e7;
goal = 3;
bins = 1 : 6;
dicenum = 3;
%% Calculation
roll = randi(6, dicenum, time);
for num = 1 : dicenum
disp([\'P(\' num2str(goal) \') = \'...
num2str(length(roll(num, roll(num, :) == goal)) / time)]);
end
%% Output result
for num = 1 : dicenum
figure, hist(roll(num), bins);
end
%% Clear up the mess
clearvars
