next up previous contents
Next: rank Up: リファレンスマニュアル Previous: rand

  
randn

【目的】
randn - 正規乱数
【形式】
y = randn()            Y = randn(n)
   Real y;                Array Y;
                          Integer n;
  
Y = randn(m,n)         Y = randn(X)
   Array Y;               Array Y;
   Integer m,n;           (Matrix|Array) X;
  
s = randn("seed");     p = randn("seed", s);
   Integer s;             Integer p;
                          Integer s;
【詳細】
randn()は,平均 0,分散 1 の正規分布する乱数を生成する。整数 n に ついて,randn(n)は n * n の正規乱数配列を返す。randn(m,n) は, m * n の正規乱数配列を返す。X が行列のとき,randn(X) は,X と同じ 大きさの正規乱数配列を返す。 乱数列は乱数発生器の状態に依存して決定され,乱数発生器の状態は 種によって変更できる。randn("seed") は正規乱数の種(Integer)を返し, randn("seed", m) は正規乱数の種を整数 m に設定する。
【例題】
1 * 4 の正規乱数配列を生成する。
>> Y = randn(1, 4)
=== [Y] : (  1,  4) ===
          (  1)         (  2)         (  3)         (  4)     
(  1) -9.833774E-01 -8.557007E-01  2.142212E-01 -8.026744E-01
【算法】
文献 1, 2 参照。
【参照】
rand(2.172)
【文献】
1.
William H. Press and Brian P. Flannery and Saul A. Teukolsky and William T. Veterling, Numerical Recipes in C (The Art of Scientific Computing), Cambridge University Press, 1988
2.
丹慶 勝市, 奥村 晴彦, 佐藤 俊朗, 小林 誠, ニューメリカルレシピ・イン・シー, 技術評論社, 1993


Masanobu KOGA 平成11年10月2日