MATLAB でモンティ ホールのパラドックスを証明するスクリプトを作成していますが、問題があります。MATLAB で前の 2 つとは異なる 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 ループの正しい使い方がわかりません。
前もって感謝します