cumsum([0.3, 0.4, 0.3])
cdf = cumsum([0.3, 0.4, 0.3]);
rng(0); u = rand();
sum(cdf <= u) + 1
rng(1); u = rand();
sum(cdf <= u) + 1
mean(rand(1, 1000) * 6 == rand(1, 1000) * 6)
mean(randi(6, 1, 1000) == randi(6, 1, 1000))
mean(mod(randi(12, 1, 1000) * 2, 2) == 1)
mean(mod(randi(6, 1, 1000) + randi(6, 1, 1000), 2) == 1)
s = zeros(1, 1000);
for t = 1:1000
    while randi(6) ~= 6
        s(t) = s(t) + 1;
    end
end
mean(s) + 1
s = zeros(1, 1000);
for t = 1:1000
    while rand() <= 0.9
        s(t) = s(t) + 1;
    end
end
mean(s) + 1