14.1.2 乱数の生成 (random)

関数 rand() は 0 と 1 の間の疑似乱数列を生成します。これは以下からのアルゴリズムを使用しています: P. L'Ecuyer and S. Cote, "Implementing arandom number package with splitting facilities", ACM Transactions onMathematical Software, 17:98-111 (1991).


     rand(0)     内部に持つ 2 つの 32bit の種 (seed) の現在の値から生
                 成される [0:1] 区間内の疑似乱数値を返す
     rand(-1)    2 つの種の値を標準値に戻す
     rand(x)     0 < x < 2^31-1 の整数なら種の両方を x に設定する
     rand({x,y}) 0 < x,y < 2^31-1 の整数なら seed1 を x に seed2 を y
                 に設定する

竹野茂治@新潟工科大学
2015年6月19日