我正在编写一个脚本来证明 MATLAB 中的蒙蒂霍尔悖论,我有一个问题 - 我不知道如何让 MATLAB 生成一个与前两个不同的 1 到 3 之间的随机数。
这是我的脚本:
% This program demostrates the Monty Hall paradox.
% A_pick1 represents where person chooses to put the five-pound note
% B_pick1 represents which box person B first identifies
% A_pick2 represents the box that person A opens up - it must be different
% than both A_pick1 and B_pick2
A_pick1 = round(3 * rand(1) + 0.5)
B_pick1 = round(3 * rand(1) + 0.5)
A_pick2 = round(3* rand(1) + 0.5);
while (A_pick2 == A_pick1 || A_pick2 == B_pick1)
A_pick2 = rand(3 * rand(1) + 0.5) ~= (A_pick1 && B_pick1)
break
end
我不确定如何正确使用 while 循环。
提前致谢