JP3580737B2 - Normal random number generator and recording medium - Google Patents

Normal random number generator and recording medium Download PDF

Info

Publication number
JP3580737B2
JP3580737B2 JP24301199A JP24301199A JP3580737B2 JP 3580737 B2 JP3580737 B2 JP 3580737B2 JP 24301199 A JP24301199 A JP 24301199A JP 24301199 A JP24301199 A JP 24301199A JP 3580737 B2 JP3580737 B2 JP 3580737B2
Authority
JP
Japan
Prior art keywords
random number
normal random
pool
generated
random numbers
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
JP24301199A
Other languages
Japanese (ja)
Other versions
JP2001067207A (en
Inventor
ブレント リチャード
誠 中西
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fujitsu Ltd
Original Assignee
Fujitsu Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP24301199A priority Critical patent/JP3580737B2/en
Publication of JP2001067207A publication Critical patent/JP2001067207A/en
Application granted granted Critical
Publication of JP3580737B2 publication Critical patent/JP3580737B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

  • Test And Diagnosis Of Digital Computers (AREA)

Description

【0001】
【産業上の利用分野】
本発明は、正規乱数を高速に生成する正規乱数生成装置および記録媒体に関するものである。
【0002】
【従来の技術】
従来、シミュレーションなどを行うときに必要となる正規分布を持った乱数(正規乱数という)を生成する場合、Pola法と呼ばれる方法で正規乱数を生成していた。
【0003】
Pola法は、基本的に以下の手順で一様乱数を使って正規乱数を生成している。
ステップ1:[−1,1]の区間の一様乱数を生成する。
【0004】
ステップ2:s←x+y
ステップ3:s≧1なら goto 1.さもなければ goto 4.
ステップ4:r←{−2ln(s)/s}1/2
ステップ5:ステップ4の結果を要求元に返す。
【0005】
ステップ6:要求された正規乱数の数分だけ、ステップ1からステップ5を繰り返す。
【0006】
【発明が解決しようとする課題】
上述したPola法による正規乱数の生成手法では、正規乱数を生成する毎にステップ4で自然対数および平方根などの演算を計算機では近似計算を行う関係で非常に多くの計算時間を必要としてしまい、シミュレーションなどで数百万(10)の正規乱数を必要とする場合には非常に多くの時間が必要となってしまう問題があった。
【0007】
本発明は、これらの問題を解決するため、インタフェースで指定された情報をもとに一様乱数を生成してこれをもとに正規乱数を生成してプールに格納し、当該プールの正規乱数をもとに新たな正規乱数を高速生成して他のプールに格納すると共にその一部を出力し、プールを切替えて所定回数繰り返したときに最初に戻り異なる一様乱数の生成などを繰り返し、インタフェース指定に対応した信頼性の高い正規乱数を自動的に高速生成することを目的としている。
【0008】
【課題を解決するための手段】
図1を参照して課題を解決するための手段を説明する。
図1において、S2は、一様乱数を生成して正規乱数を生成し、プール1に入れたりなどする。
【0009】
S5、S6は、プールから取り出した正規乱数から他の正規乱数を生成したりなどする。
S9は、他の正規乱数を生成した生成回数が所定値(例えば1000回)を越えたときに、一様乱数から正規乱数を生成してプールに格納したりなどするものである。
【0010】
次に、動作を説明する。
S2で一様乱数を生成して生成された一様乱数をもとに正規乱数を生成し、生成された正規乱数をプール1に格納し、S5でプール1に格納された正規乱数をもとに他の正規乱数を生成し、生成された他の正規乱数をプール2に格納すると共に生成された他の正規乱数から一部を取り出し、出力した正規乱数の数が指定数に到達しないときにプール1とプール2とを切替えて他の正規乱数を生成・格納およびその一部を出力することを繰り返えすようにしている。
【0011】
この際、S9で所定回数だけ他の正規乱数の生成を繰り返したときに一様乱数を生成してこれをもとに新たな正規乱数を生成してプールに格納し、他の正規乱数の生成を再開するようにしている。
【0012】
また、一様乱数を生成するときに必要な情報、一様乱数をもとに正規乱数を生成するときに必要な情報、正規乱数から他の正規乱数を生成するときに必要な情報、他の正規乱数の一部を出力するときに必要な情報、一様乱数を再生成して新たな正規乱数を生成するときに必要な情報のうちの少なくとも1つ以上を設定したインタフェースを設け、インタフェースに従い正規乱数を生成して出力するにしている。
【0013】
従って、インタフェースで指定された情報をもとに一様乱数を生成してこれをもとに正規乱数を生成してプールに格納し、プールの正規乱数をもとに新たな正規乱数を高速生成して他のプールに格納すると共にその一部を出力し、プールを切替えて所定回数繰り返したときに最初に戻り異なる一様乱数の生成などを繰り返すことにより、インタフェース指定に対応した信頼性の高い正規乱数を自動的に高速生成することが可能となる。
【0014】
【実施例】
次に、図1から図4を用いて本発明の実施の形態および動作を順次詳細に説明する。
【0015】
図1は、本発明の動作説明図を示す。
図1において、S1は、変数seedがゼロか判別する。YESの場合には、変数seedがゼロであって、最初と判明したので、S2に進む。NOの場合には、S3に進む。
【0016】
S2は、
・一様乱数を生成して正規乱数を生成する。これは、例えば既述したPola法により初回のみ正規乱数を生成する。具体的には、インタフェース情報で指定された初期値(正の整数)をもとに一様乱数を生成し、次に、この生成した一様乱数をもとに正規乱数を生成する。
【0017】
・プール1に入れる。これは、生成した正規乱数をプール1に格納する(図3の(a)のプール1に格納する)。
・変数ip=1とし、正規乱数をプール1に格納したことを記憶しておく。
【0018】
・変数seedをゼロに設定する。
S3は、
・a,b,c,d,θを決める。これは、各変数の値を下記のようにして決める。
【0019】
・a,bは、a∈{3,5},b∈{7,11}から一様に選ぶ。
・c,dは、{0,1、・・・N−1}から一様にランダムに選ぶ。
・θは、後述する図3の(d)の斜線の範囲内で一様にランダムに選ぶ。
【0020】
S4は、変数ip=1か判別する。YESの場合には、S5に進む。NOの場合には、S6に進む。
S5は、
・プール1から2N個の正規乱数で他の正規乱数を生成し、プール2に入れる。これは、図3の(a)で後述するように、プール1から取り出した2N個の正規乱数に、直交行列を演算して他の一様な新たな正規乱数を生成し、プール2に入れる。
【0021】
・ip=2とする。
・そのうち最初の1/f(例えば1/3)を出力バッファに書き出す。
S6は、
・プール2から2N個の正規乱数で他の正規乱数を生成し、プール1に入れる。これは、図3の(a)で後述するように、プール2から取り出した2N個の正規乱数に、直交行列を演算して他の一様な新たな正規乱数を生成し、プール1に入れる。
【0022】
・ip=1とする。
・そのうち最初の1/f(例えば1/3)を出力バッファに書き出す。
S7は、正規乱数の生成回数を+1する。
【0023】
S8は、N個(ユーザ指定)の正規乱数を出力したかを判別する。YESの場合には、終了する。NOの場合には、S9に進む。
S9は、正規乱数の生成回数が1000回か判別する。YESの場合には、プール1からプール2、およびプール2からプール1へ正規乱数を取り出して直交変換して新たな一様な正規乱数を生成して格納することを1000回行い、規則性が生じる危険性が生じたか判別する。YESの場合には、S2に戻り、新たな初期値をもとに一様乱数を生成し、これをもとに新たなパラメタ(a,b,c,d,θ等)を用いて正規乱数を生成してプール1に格納し、S4以降を繰り返し、ユーザ指定の正規乱数の数分だけ出力するまで繰り返す。
【0024】
以上によって、インタフェース情報で指定された情報をもとに一様乱数を生成し、この一様乱数をもとにインタフェース情報で指定されたパラメータ(a,b,c,d,θなど)をもとに正規乱数を生成してプール1に格納し、プール1から取り出した正規乱数をもとにインタフェース情報で指定されたパラメータ(a,b,c,d,θなど)をもとに新たな正規乱数を高速生成してプール2に格納することを繰り返し、インタフェース情報で指定された数の正規乱数を出力することにより、インタフェース情報(後述する図4参照)を設定して入力するのみで自動的に指定した数の正規乱数を取得することが可能となる。この際、正規乱数をもとに新たな正規乱数を生成することで、従来のPola法による一様乱数から正規乱数を生成するときの多くの時間の必要となる演算(自然対数、平方根などの近似式を用いたループ演算で通常の演算に比して約3倍以上の時間が必要となる演算)がなくなり、極めて高速に多量の一様な正規乱数を自動生成することが可能となる。
【0025】
図2は、本発明の説明図を示す。
図2の(a)は、正規乱数から新たな正規乱数を求める行列式を示す。これは、公知のWallace法を変形したものであって、右辺の行列式で表される正規乱数にA(直交行列)を演算して、左辺の新たな正規乱数を求める式である。変数a,b,c,d,およびA(直交変数)の変数θは(b)から(e)に示すように決定する。この行列式を用いることにより、プール1/プール2から取り出した正規乱数をもとに、新たな正規乱数を生成してプール2/プール1に格納することが可能となる。
【0026】
図2の(b)は、図2の(a)の変数a,b,c,d,Nの大きさなどを示す。ここでは、図示の下記のようである。
・a>b>1でa,b,c、dは正の整数であり、このとき、aとN、bとNは互いに素である。
【0027】
図2の(c)は、図2の(a)の直交行列の例を示す。ここでは、図示のような直交行列であって、図示の下記のようなθの範囲を持つ。
・π/6≦θ≦π/3 or 2π/3≦θ≦5π/6であって、
min(|sinθ|、|cosθ|)≧1/2となり、
t=tan(θ/2)を適当な区間の一様乱数から生成して、cosθ、sinθを計算する。
【0028】
図2の(d)は、生成された正規乱数のうち1/f(f≧3)をユーザに返却して、次のスプールに使う様子を示す。
図2の(e)は、a,b,c,dの選び方を示す。ここでは、例えば
・a,bは各プールに対してa∈{3,5},b∈{7,11}から、
・c,dは{0,1・・・(N−1)}から一様にランダム
にそれぞれ選ぶ。
【0029】
図2の(f)は、長い正規乱数の生成の仕方を示す。ここでは、1000N個(1000組)の正規乱数を生成した後、よい一様乱数で新しく正規乱数を生成することで更に、長い正規乱数の生成を可能にしている。
【0030】
図3は、本発明の説明図を示す。
図3の(a)は、プール例を示す。これは、既述した図1のS2、S5、S6で生成した正規乱数を格納するメモリである。図1のS5、S6では、プール1/プール2から取り出した正規乱数をもとに、図2の(a)の行列式に従い新たな正規乱数を生成してプール2/プール1に格納することを、切替える態様で繰り返すためのものである。
【0031】
図3の(b)は、正規乱数をイメージ的に示す。ここで、横軸は正規乱数の値を表し、縦軸はそのときの正規乱数の頻度(個数)を表す。正規乱数は、図示のように、正規分布をしており、全ての正規乱数の平均値を中心に、所定の分散値を持つものである。
【0032】
図3の(c)は、出力例を示す。生成されたプール1,2に格納された正規乱数の一部(既述した1/fで決る一部、例えば先頭から1/3の斜線の部分)を取り出して出力バッファに順次格納し、出力バッファに指定された数の正規乱数が格納されたときに、まとめて要求元に返却する。
【0033】
図3の(d)は、θの範囲を示す。既述した直交行列に使用するθの範囲は、計算誤差を小さくするために、図示の斜線の範囲内で、一様な乱数で決定する(既述した図2の(c)参照)。
【0034】
図4は、本発明のインタフェース例を示す。これは、既述した図1のフローチャートに従い正規乱数を生成するときの各種パラメータ(既述したa,b,c,d,θ、正規乱数の出力数など)を指定するインタフェースであって、図示の下記のインタフェースに必要な情報を設定して図1の処理を実行する関数(ルーチン)に渡す(呼び出して渡す)のみで自動的に指定した条件のもとで生成した正規乱数を受取ることが可能となる。
【0035】
CALL DVRANA(DAM,DSD,IX,DA,N,DWORK,NWORK,ICON)
DAM(入力):正規分布の平均m
DSD(入力):正規分布の標準偏差
IX(入力):入力出発値(Seed),初回は正の整数、2回目以降はゼロが返却される。
【0036】
DA(出力):N個の正規乱数
N(入力):DAに返却される正規乱数の個数
DWORK(作業域):大きさNWORKの1次元配列
NWORK(入力):配列DWORKの大きさ
ICON(出力):コンディションコード
【0037】
【発明の効果】
以上説明したように、本発明によれば、インタフェースで指定された情報をもとに一様乱数を生成してこれをもとに正規乱数を生成してプールに格納し、プールの正規乱数をもとに新たな正規乱数を高速生成して他のプールに格納すると共にその一部を出力し、プールを切替えて所定回数繰り返したときに最初に戻り異なる一様乱数の生成などを繰り返す構成を採用しているため、インタフェース指定に対応した信頼性の高い正規乱数を自動的に高速生成できる。例えば従来技術の欄で説明したPola法のときに正規乱数を生成する毎に自然対数や平方根などの非常に時間のかかる場合に比して、本願発明では自然対数や平方根などのような近似式を用いて演算に長時間かかる演算を無くして正規乱数の生成を高速化できると共に、更に、行列式を用いて正規乱数から新たな正規乱数を生成することでベクトル計算機を使用して高速に多量の正規乱数を生成することが可能となる。これらにより、多量の正規乱数を用いて行うシュミレーションなどの高速化を図ることが可能となる。
【図面の簡単な説明】
【図1】本発明の動作説明図である。
【図2】本発明の説明図(その1)である。
【図3】本発明の説明図(その2)である。
【図4】本発明のインタフェース例である。
【符号の説明】
S2:一様乱数生成
S3:パラメータの生成
S5、S6:正規乱数から新たな正規乱数の生成
S9:新たな一様乱数/正規乱数の生成
[0001]
[Industrial applications]
The present invention relates to a normal random number generation device and a recording medium that generate normal random numbers at high speed.
[0002]
[Prior art]
Conventionally, when generating random numbers having a normal distribution (called normal random numbers) required for performing a simulation or the like, normal random numbers have been generated by a method called the Pola method.
[0003]
The Pola method basically generates normal random numbers using uniform random numbers in the following procedure.
Step 1: Generate a uniform random number in the section [-1, 1].
[0004]
Step 2: s ← x 2 + y 2
Step 3: If s ≧ 1, goto Otherwise goto 4.
Step 4: r ← {−2ln (s) / s} 1/2
Step 5: Return the result of step 4 to the request source.
[0005]
Step 6: Steps 1 to 5 are repeated for the requested number of normal random numbers.
[0006]
[Problems to be solved by the invention]
In the above-described method of generating normal random numbers by the Pola method, every time a normal random number is generated, the calculation such as natural logarithm and square root is performed by a computer so that a large amount of calculation time is required because a computer performs an approximate calculation. For example, when millions (10 6 ) of normal random numbers are required, there is a problem that an extremely long time is required.
[0007]
In order to solve these problems, the present invention generates a uniform random number based on information specified by an interface, generates a normal random number based on the random number, stores the generated random number in a pool, and stores the normal random number in the pool. Based on the above, a new normal random number is generated at high speed and stored in another pool and a part of the pool is output.When the pool is switched and repeated a predetermined number of times, the process returns to the beginning and repeats generation of a different uniform random number, The purpose is to automatically generate high-speed reliable normal random numbers corresponding to the interface specification.
[0008]
[Means for Solving the Problems]
Means for solving the problem will be described with reference to FIG.
In FIG. 1, S2 generates a uniform random number, generates a normal random number, and puts the random number into the pool 1.
[0009]
In steps S5 and S6, other normal random numbers are generated from the normal random numbers extracted from the pool.
In step S9, when the number of times of generation of another normal random number exceeds a predetermined value (for example, 1000 times), a normal random number is generated from a uniform random number and stored in a pool.
[0010]
Next, the operation will be described.
A normal random number is generated based on the uniform random number generated by generating the uniform random number in S2, the generated normal random number is stored in the pool 1, and the generated normal random number is stored in the pool 1 in S5. Generates another normal random number, stores the generated other normal random number in the pool 2 and extracts a part from the generated other normal random number. When the number of output normal random numbers does not reach the specified number, By switching between pool 1 and pool 2, generation and storage of another normal random number and output of a part thereof are repeated.
[0011]
At this time, when the generation of another normal random number is repeated a predetermined number of times in S9, a uniform random number is generated, a new normal random number is generated based on the uniform random number, and stored in the pool. To resume.
[0012]
In addition, information required when generating uniform random numbers, information required when generating normal random numbers based on uniform random numbers, information necessary when generating other normal random numbers from normal random numbers, Provide an interface that sets at least one of the information required to output a part of the normal random number and the information required to generate a new normal random number by regenerating a uniform random number. It generates and outputs normal random numbers.
[0013]
Therefore, a uniform random number is generated based on the information specified by the interface, a normal random number is generated based on the random number, stored in the pool, and a new normal random number is rapidly generated based on the pool's normal random number. By storing the data in another pool and outputting a part of the data, when the pool is switched and repeated a predetermined number of times, the process returns to the beginning and repeats the generation of a different uniform random number, etc. Normal random numbers can be automatically generated at high speed.
[0014]
【Example】
Next, an embodiment and operation of the present invention will be sequentially described in detail with reference to FIGS.
[0015]
FIG. 1 shows an operation explanatory diagram of the present invention.
In FIG. 1, S1 determines whether the variable seed is zero. In the case of YES, the variable seed is zero and has been found to be the first, so the process proceeds to S2. In the case of NO, the process proceeds to S3.
[0016]
S2 is
-Generate uniform random numbers and generate normal random numbers. In this method, for example, a normal random number is generated only for the first time by the Pola method described above. Specifically, a uniform random number is generated based on an initial value (positive integer) specified by the interface information, and then a normal random number is generated based on the generated uniform random number.
[0017]
・ Put into pool 1. In this case, the generated normal random numbers are stored in the pool 1 (stored in the pool 1 in FIG. 3A).
The variable ip = 1 is set, and the fact that the normal random number is stored in the pool 1 is stored.
[0018]
-Set the variable seed to zero.
S3 is,
Determine a, b, c, d, and θ. This determines the value of each variable as follows.
[0019]
A and b are uniformly selected from a {3, 5}, b {7, 11}.
C and d are uniformly and randomly selected from {0, 1,... N-1}.
.Theta. Is uniformly and randomly selected within the range of the oblique line in FIG.
[0020]
A step S4 decides whether or not the variable ip = 1. In the case of YES, the process proceeds to S5. In the case of NO, the process proceeds to S6.
S5 is
Generate another normal random number from pool 1 using 2N normal random numbers, and put it into pool 2. This is, as will be described later with reference to FIG. 3A, an orthogonal matrix is operated on 2N normal random numbers extracted from the pool 1 to generate another uniform new normal random number and put into the pool 2. .
[0021]
-Let ip = 2.
Write the first 1 / f (for example, 1/3) of them to the output buffer.
S6 is
Generate another normal random number from the pool 2 with 2N normal random numbers and put it into the pool 1. This is, as will be described later with reference to FIG. 3A, an orthogonal matrix is operated on 2N normal random numbers extracted from the pool 2 to generate another uniform new normal random number and put into the pool 1. .
[0022]
・ Set ip = 1.
Write the first 1 / f (for example, 1/3) of them to the output buffer.
In step S7, the number of times of generation of the normal random number is incremented by one.
[0023]
In S8, it is determined whether or not N (user-specified) normal random numbers have been output. If YES, the process ends. In the case of NO, the process proceeds to S9.
In S9, it is determined whether or not the number of times of generation of the normal random number is 1,000. In the case of YES, normal random numbers are taken out from pool 1 to pool 2 and from pool 2 to pool 1 and orthogonally transformed to generate and store new uniform normal random numbers 1000 times. Determine if any dangers occur. In the case of YES, the process returns to S2, generates a uniform random number based on the new initial value, and uses the new parameters (a, b, c, d, θ, etc.) based on this to generate a normal random number. Is generated and stored in the pool 1, and S4 and subsequent steps are repeated until the number of normal random numbers specified by the user is output.
[0024]
As described above, a uniform random number is generated based on the information specified by the interface information, and the parameters (a, b, c, d, θ, etc.) specified by the interface information are also determined based on the uniform random number. And generates a normal random number in the pool 1 and stores it in the pool 1. Based on the normal random number extracted from the pool 1, a new random number is generated based on parameters (a, b, c, d, θ, etc.) specified in the interface information. By repeatedly generating high-speed normal random numbers and storing them in the pool 2 and outputting the number of normal random numbers specified by the interface information, automatic setting is performed only by setting and inputting interface information (see FIG. 4 described later). It is possible to acquire a specified number of normal random numbers. At this time, by generating a new normal random number based on the normal random number, an operation (such as a natural logarithm or a square root) that requires a lot of time when generating a normal random number from a uniform random number by the conventional Pola method is performed. This eliminates the need for a loop operation using an approximate expression that requires about three times or more the time required for a normal operation), and makes it possible to automatically generate a large number of uniform normal random numbers extremely quickly.
[0025]
FIG. 2 shows an explanatory diagram of the present invention.
FIG. 2A shows a determinant for obtaining a new normal random number from the normal random numbers. This is a modified version of the well-known Wallace method, and calculates A (orthogonal matrix) on a normal random number represented by the determinant on the right side to obtain a new normal random number on the left side. The variables a, b, c, d and the variable θ of A (orthogonal variable) are determined as shown in (b) to (e). By using this determinant, new normal random numbers can be generated based on the normal random numbers extracted from pool 1 / pool 2 and stored in pool 2 / pool 1.
[0026]
FIG. 2B shows the magnitudes of variables a, b, c, d, and N in FIG. 2A. Here, the following is illustrated.
A>b> 1 and a, b, c, and d are positive integers, where a and N and b and N are relatively prime.
[0027]
FIG. 2C shows an example of the orthogonal matrix of FIG. Here, it is an orthogonal matrix as shown, and has a range of θ as shown below.
Π / 6 ≦ θ ≦ π / 3 or 2π / 3 ≦ θ ≦ 5π / 6,
min (| sin θ |, | cos θ |) ≧ 1/2,
t = tan (θ / 2) is generated from uniform random numbers in an appropriate section, and cos θ and sin θ are calculated.
[0028]
FIG. 2D shows a state in which 1 / f (f ≧ 3) of the generated normal random numbers is returned to the user and used for the next spool.
FIG. 2E shows how to select a, b, c, and d. Here, for example, a and b are from a {3,5}, b {7,11} for each pool,
C and d are uniformly and randomly selected from {0, 1... (N-1)}.
[0029]
FIG. 2F shows how to generate a long normal random number. Here, after generating 1000N (1000 sets) normal random numbers, a new normal random number is generated using good uniform random numbers, thereby enabling generation of a longer normal random number.
[0030]
FIG. 3 shows an explanatory diagram of the present invention.
FIG. 3A shows an example of a pool. This is a memory for storing the normal random numbers generated in S2, S5, and S6 of FIG. 1 described above. In S5 and S6 in FIG. 1, new normal random numbers are generated in accordance with the determinant of FIG. 2A based on the normal random numbers extracted from pool 1 / pool 2 and stored in pool 2 / pool 1. Is repeated in a switching manner.
[0031]
FIG. 3B schematically shows normal random numbers. Here, the horizontal axis represents the value of the normal random number, and the vertical axis represents the frequency (number) of the normal random number at that time. The normal random numbers have a normal distribution as shown in the figure, and have a predetermined variance around the average value of all the normal random numbers.
[0032]
FIG. 3C shows an output example. A part of the normal random numbers stored in the generated pools 1 and 2 (a part determined by 1 / f as described above, for example, a 1/3 hatched part from the beginning) is taken out, sequentially stored in an output buffer, and output. When the specified number of normal random numbers are stored in the buffer, they are returned together to the request source.
[0033]
FIG. 3D shows the range of θ. The range of θ used in the above-described orthogonal matrix is determined by a uniform random number within the shaded area shown in the drawing in order to reduce the calculation error (see FIG. 2C described above).
[0034]
FIG. 4 shows an example of an interface according to the present invention. This is an interface for specifying various parameters (such as a, b, c, d, θ, and the number of outputs of the normal random numbers) when generating the normal random numbers according to the flowchart of FIG. By setting necessary information in the following interface and passing (calling and passing) it to the function (routine) that executes the processing of FIG. 1, it is possible to receive the normal random number generated under the automatically specified condition. It becomes possible.
[0035]
CALL DVRANA (DAM, DSD, IX, DA, N, DWORK, NWORK, ICON)
DAM (input): mean of normal distribution m
DSD (input): standard deviation of normal distribution IX (input): input starting value (Seed), a positive integer for the first time, and zero for the second and subsequent times.
[0036]
DA (output): N normal random numbers N (input): number of normal random numbers returned to DA DWORK (work area): one-dimensional array of size NWORK NWORK (input): size ICON of array DWORK (output ): Condition code [0037]
【The invention's effect】
As described above, according to the present invention, a uniform random number is generated based on information specified by an interface, a normal random number is generated based on the random number, and stored in a pool. A configuration in which a new normal random number is generated at high speed, stored in another pool, and a part of the pool is output. Since it is adopted, highly reliable normal random numbers corresponding to interface designation can be automatically generated at high speed. For example, in the present invention, an approximate expression such as a natural logarithm or a square root is compared with a case where it takes a very long time such as a natural logarithm or a square root every time a normal random number is generated in the Pola method described in the section of the related art. , The generation of normal random numbers can be speeded up by eliminating the operation that takes a long time, and the generation of new normal random numbers from the normal random numbers using a determinant allows high-speed generation of large numbers using a vector computer. Can be generated. As a result, it is possible to increase the speed of a simulation or the like performed using a large number of normal random numbers.
[Brief description of the drawings]
FIG. 1 is a diagram illustrating the operation of the present invention.
FIG. 2 is an explanatory view (No. 1) of the present invention.
FIG. 3 is an explanatory diagram (No. 2) of the present invention.
FIG. 4 is an example of an interface according to the present invention.
[Explanation of symbols]
S2: Generating uniform random numbers S3: Generating parameters S5, S6: Generating new normal random numbers from normal random numbers S9: Generating new uniform random numbers / normal random numbers

Claims (4)

正規乱数を高速に生成する正規乱数生成装置において、
一様乱数を生成する手段と、
上記生成された一様乱数をもとに正規乱数を生成する第1の正規乱数生成手段と、
上記生成された正規乱数を格納する第1のプールと、
上記第1のプールに格納された正規乱数をもとに他の正規乱数を生成する第2の正規乱数生成手段と、
上記生成された他の正規乱数を格納する第2のプールと、
上記生成された他の正規乱数から一部を取り出して出力する手段と、
上記出力した正規乱数の数が指定数に到達しないときに、上記第1のプールと上記第2のプールとを切替えて他の正規乱数を生成およびその一部を出力することを繰り返えさせる手段と
を備えたことを特徴とする正規乱数生成装置。
In a normal random number generator that generates normal random numbers at high speed,
Means for generating a uniform random number;
First normal random number generation means for generating a normal random number based on the generated uniform random number;
A first pool for storing the generated normal random numbers;
A second normal random number generation means for generating another normal random number based on the normal random number stored in the first pool;
A second pool for storing the other generated normal random numbers,
Means for extracting and outputting a part from the other generated normal random numbers,
When the number of the outputted normal random numbers does not reach the designated number, switching between the first pool and the second pool to generate another normal random number and output a part thereof is repeated. And a means for generating a normal random number.
所定回数だけ上記他の正規乱数の生成を繰り返したときに上記一様乱数を生成してこれをもとに新たな正規乱数を生成して上記第1のプールに格納し、他の正規乱数の生成を再開することを特徴とする請求項1記載の正規乱数生成装置。When the generation of the other normal random number is repeated a predetermined number of times, the uniform random number is generated, a new normal random number is generated based on the uniform random number, and stored in the first pool. 2. The normal random number generation device according to claim 1, wherein the generation is restarted. 上記一様乱数を生成するときに必要な情報、上記一様乱数をもとに正規乱数を生成するときに必要な情報、上記正規乱数から他の正規乱数を生成するときに必要な情報、上記他の正規乱数の一部を出力するときに必要な情報、上記一様乱数を再生成して新たな正規乱数を生成するときに必要な情報のうちの少なくとも1つ以上を設定したインタフェースを備え、
当該インタフェースに従い、上記正規乱数を生成して出力することを特徴とする請求項1あるいは請求項2記載の正規乱数生成装置。
The information required when generating the uniform random number, the information required when generating a normal random number based on the uniform random number, the information required when generating another normal random number from the normal random number, An interface in which at least one of information necessary for outputting a part of another normal random number and information necessary for generating a new normal random number by regenerating the uniform random number is provided. ,
3. The normal random number generation device according to claim 1, wherein the normal random number is generated and output according to the interface.
一様乱数を生成する手段と、
上記生成された一様乱数をもとに正規乱数を生成する第1の正規乱数生成手段と、
上記生成された正規乱数を第1のプールに格納する手段と、
上記第1のプールに格納された正規乱数をもとに他の正規乱数を生成する第2の正規乱数生成手段と、
上記生成された他の正規乱数を第2のプールに格納する手段と、
上記生成された他の正規乱数から一部を取り出して出力する手段と、
上記出力した正規乱数の数が指定数に到達しないときに、上記第1のプールと上記第2のプールとを切替えて他の正規乱数を生成およびその一部を出力することを繰り返えさせる手段と
して機能させるプログラムを記録したコンピュータ読取可能な記録媒体。
Means for generating a uniform random number;
First normal random number generation means for generating a normal random number based on the generated uniform random number;
Means for storing the generated normal random numbers in a first pool;
A second normal random number generation means for generating another normal random number based on the normal random number stored in the first pool;
Means for storing the other generated normal random numbers in a second pool;
Means for extracting and outputting a part from the other generated normal random numbers,
When the number of the outputted normal random numbers does not reach the designated number, switching between the first pool and the second pool to generate another normal random number and output a part thereof is repeated. A computer-readable recording medium on which a program for functioning as means is recorded.
JP24301199A 1999-08-30 1999-08-30 Normal random number generator and recording medium Expired - Fee Related JP3580737B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP24301199A JP3580737B2 (en) 1999-08-30 1999-08-30 Normal random number generator and recording medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP24301199A JP3580737B2 (en) 1999-08-30 1999-08-30 Normal random number generator and recording medium

Publications (2)

Publication Number Publication Date
JP2001067207A JP2001067207A (en) 2001-03-16
JP3580737B2 true JP3580737B2 (en) 2004-10-27

Family

ID=17097568

Family Applications (1)

Application Number Title Priority Date Filing Date
JP24301199A Expired - Fee Related JP3580737B2 (en) 1999-08-30 1999-08-30 Normal random number generator and recording medium

Country Status (1)

Country Link
JP (1) JP3580737B2 (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4952461B2 (en) * 2007-09-12 2012-06-13 ソニー株式会社 Random number generation apparatus and random number generation method
JP5273613B2 (en) * 2009-03-31 2013-08-28 独立行政法人国立高等専門学校機構 Random number generation apparatus, random number generation method, random number generation program, and simulation apparatus
JP5953808B2 (en) * 2012-02-23 2016-07-20 日本電気株式会社 Random number processing apparatus, random number processing method, and program
JP7276047B2 (en) * 2019-09-26 2023-05-18 富士通株式会社 Random number generator and random number generation method

Also Published As

Publication number Publication date
JP2001067207A (en) 2001-03-16

Similar Documents

Publication Publication Date Title
US7761397B2 (en) Rule processing method and apparatus providing automatic user input selections
JP2002501639A (en) Adaptive mesh refinement method and apparatus
KR20060125860A (en) Zero-knowledge proof cryptography methods and devices
CN110223218A (en) Face image processing process, device, electronic equipment and storage medium
CN109410043B (en) Block chain information efficient storage method and device based on hierarchical tree structure
WO2020020127A1 (en) Private key storage and reading method and apparatus, and hardware device
CN116933222B (en) Three-dimensional model copyright authentication method and system based on zero watermark
JP3580737B2 (en) Normal random number generator and recording medium
EP2548329B1 (en) Data expansion using an approximate method
CN112287366A (en) Data encryption method and device, computer equipment and storage medium
CN111640012A (en) Block chain transaction tracing method and device
CN117194756A (en) Data processing method, device and storage medium
CN116260572B (en) Data hash processing method, data verification method and electronic equipment
CN115374659B (en) Electric turbulence control method and device and electronic equipment
CN108599951A (en) Encryption method and device
CN114861203A (en) Secret intersection solving method based on accidental pseudorandom function
CN110048844A (en) Realize more times of point calculating methods, devices of SM2 algorithm
Margalit A parallel algorithm to generate a Markov random field image on a SIMD hypercube machine
CN110008028A (en) Computational resource allocation method, apparatus, computer equipment and storage medium
TWI775467B (en) Machine learning model file decryption method and user device
Buchheim et al. A basic toolbox for constrained quadratic 0/1 optimization
KR19990058284A (en) How to reduce the amount of mesh data
Coêlho et al. ARTMe: a new array-based algorithm for Adaptive Refinement of Triangle Meshes
CN116305192A (en) Data file processing method and device, electronic equipment and storage medium
JPH0679316B2 (en) Search method and apparatus for constraint / satisfaction problem

Legal Events

Date Code Title Description
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20040127

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20040210

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20040706

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20040720

R150 Certificate of patent (=grant) or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

FPAY Renewal fee payment (prs date is renewal date of database)

Free format text: PAYMENT UNTIL: 20080730

Year of fee payment: 4

FPAY Renewal fee payment (prs date is renewal date of database)

Free format text: PAYMENT UNTIL: 20090730

Year of fee payment: 5

FPAY Renewal fee payment (prs date is renewal date of database)

Free format text: PAYMENT UNTIL: 20100730

Year of fee payment: 6

FPAY Renewal fee payment (prs date is renewal date of database)

Free format text: PAYMENT UNTIL: 20100730

Year of fee payment: 6

FPAY Renewal fee payment (prs date is renewal date of database)

Free format text: PAYMENT UNTIL: 20110730

Year of fee payment: 7

FPAY Renewal fee payment (prs date is renewal date of database)

Free format text: PAYMENT UNTIL: 20110730

Year of fee payment: 7

FPAY Renewal fee payment (prs date is renewal date of database)

Free format text: PAYMENT UNTIL: 20120730

Year of fee payment: 8

FPAY Renewal fee payment (prs date is renewal date of database)

Free format text: PAYMENT UNTIL: 20120730

Year of fee payment: 8

FPAY Renewal fee payment (prs date is renewal date of database)

Free format text: PAYMENT UNTIL: 20130730

Year of fee payment: 9

LAPS Cancellation because of no payment of annual fees