Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
1、2、3 の 3 つの数字がある確率があります。それぞれが 1/3 の確率で選択されます。
MATLAB でこの関数を作成するにはどうすればよいですか?
この関数で十分です。
randi(3)
関数 rand は、間隔 (0,1) に均一に分布する乱数 (または数値の行列) を返します。
これを使用して範囲に変換できます
ceil(rand()*3)