[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

JPH0689163A - Random number generator - Google Patents

Random number generator

Info

Publication number
JPH0689163A
JPH0689163A JP4239816A JP23981692A JPH0689163A JP H0689163 A JPH0689163 A JP H0689163A JP 4239816 A JP4239816 A JP 4239816A JP 23981692 A JP23981692 A JP 23981692A JP H0689163 A JPH0689163 A JP H0689163A
Authority
JP
Japan
Prior art keywords
output
floating point
bits
random number
circuit
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.)
Pending
Application number
JP4239816A
Other languages
Japanese (ja)
Inventor
Tetsuo Kawada
哲郎 河田
Nobuaki Miyagawa
宣明 宮川
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.)
Fujifilm Business Innovation Corp
Original Assignee
Fuji Xerox Co 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 Fuji Xerox Co Ltd filed Critical Fuji Xerox Co Ltd
Priority to JP4239816A priority Critical patent/JPH0689163A/en
Publication of JPH0689163A publication Critical patent/JPH0689163A/en
Pending legal-status Critical Current

Links

Landscapes

  • Complex Calculations (AREA)

Abstract

PURPOSE:To generate random numbers at a high speed by selecting whether to take an upper half inside the output bits of a mantissa part arithmetic circuit on to take a low-order half. CONSTITUTION:In normal floating point multiplication, the output 4 of upper N bits is outputted as the output of the mantissa part arithmetic circuit 3. However, in random number generation, it is required to select the output 5 of low-order N bits as a multiplied result from a prescribed formula. The selection is performed using a selection signal 8 and a selection circuit 6. That is, the selection signal 8 is generated by the instruction of a program or an user, the upper N bits are selected at the time of operation as the normal floating point multiplier and the low-order N bits are selected at the time of generating the random number. Since the output 7 of the selection circuit 6 is not necessarily normalized, it is normalized at a normalization circuit 9 so as to be utilized in a floating point operation.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【産業上の利用分野】本発明は、乱数を発生する装置に
関するものである。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a device for generating random numbers.

【0002】[0002]

【従来の技術】乱数を発生する手法としては種々知られ
ているが、その一つとして乗算合同法を用いた方法が知
られている(林知己夫著、「乱数の知識」、森北出版参
照)。従来、乗算合同法を用いて乱数を高速に発生する
場合、特開昭57−8846号に記載されているように
整数型演算の可能な乗算器を必要とした。ところが、デ
ィジタル処理装置の中には浮動小数点乗算器しか備えて
いないものや、また必要としないものがある。このよう
な場合、乱数発生のためにのみ整数演算が可能な乗算器
や他の発生回路を新しく備えることは極めて不経済であ
る。
2. Description of the Related Art There are various known methods for generating random numbers, one of which is the method using the congruential multiplication method (see Tomio Hayashi, "Knowledge of Random Numbers", Morikita Publishing). . Conventionally, when a random number is generated at high speed by using the congruential multiplication method, a multiplier capable of integer type arithmetic as described in JP-A-57-8846 is required. However, some digital processing devices have only a floating point multiplier and some do not. In such a case, it is extremely uneconomical to newly provide a multiplier capable of performing an integer operation only for generating a random number and another generating circuit.

【0003】そこで浮動小数点乗算器を用いて乱数を発
生することが考えられる。図2は、従来の浮動小数点乗
算器を示しており、1は浮動小数点乗算器の仮数部演算
回路の第1入力、2は浮動小数点乗算器の仮数部演算回
路の第2入力、3は浮動小数点乗算器の仮数部演算回
路、4は浮動小数点乗算器の仮数部演算回路の出力の上
位半分、5は浮動小数点乗算器の仮数部演算回路の出力
の下位半分である。
Therefore, it may be considered to generate a random number by using a floating point multiplier. FIG. 2 shows a conventional floating point multiplier, where 1 is the first input of the mantissa arithmetic circuit of the floating point multiplier, 2 is the second input of the mantissa arithmetic circuit of the floating point multiplier, and 3 is the floating point. The mantissa arithmetic circuit of the decimal point multiplier, 4 is the upper half of the output of the mantissa arithmetic circuit of the floating point multiplier, and 5 is the lower half of the output of the mantissa arithmetic circuit of the floating point multiplier.

【0004】図2において、通常、浮動小数点乗算器の
仮数部演算回路3の出力としては仮数部乗算結果の上位
Nビット4のみが出力されるため、乱数発生に浮動小数
点乗算器を用いることはできなかった。
In FIG. 2, since only the upper N bits 4 of the mantissa part multiplication result are normally output as the output of the mantissa part arithmetic circuit 3 of the floating point multiplier, it is not possible to use the floating point multiplier for random number generation. could not.

【0005】[0005]

【発明が解決しようとする課題】そこで本発明は、浮動
小数点乗算器を用いて、乱数を高速に発生することを課
題とする。
Therefore, an object of the present invention is to generate a random number at high speed by using a floating point multiplier.

【0006】[0006]

【課題を解決するための手段】本発明の乱数発生装置
は、仮数部演算回路の出力ビットの内の上位半分と下位
半分とに分けて出力可能な浮動小数点乗算器と、前記仮
数部演算回路の出力ビットの内の上位半分をとるか下位
半分をとるかを選択する選択回路とを備えたことを特徴
とする。
SUMMARY OF THE INVENTION A random number generator according to the present invention is a floating point multiplier capable of separately outputting to upper half and lower half of output bits of a mantissa arithmetic circuit, and the mantissa arithmetic circuit. And a selection circuit for selecting whether to take the upper half or the lower half of the output bits.

【0007】[0007]

【作用】仮数部演算回路の出力ビットの内の上位半分が
選択されたときには、浮動小数点乗算器は浮動小数点乗
算を行ったときの乗算結果を出力し、仮数部演算回路の
出力ビットの内の下位半分が選択されたときには、浮動
小数点乗算器は乱数を発生する。
When the upper half of the output bits of the mantissa arithmetic circuit is selected, the floating-point multiplier outputs the multiplication result of the floating-point multiplication, and the output bits of the mantissa arithmetic circuit are output. The floating point multiplier generates a random number when the lower half is selected.

【0008】[0008]

【実施例】本発明の実施例を述べる。EXAMPLES Examples of the present invention will be described.

【0009】図1は実施例の乱数発生装置のブロック図
である。1は浮動小数点乗算器の仮数部演算回路の第1
入力、2は浮動小数点乗算器の仮数部演算回路の第2入
力、3は出力ビットの内の上位半分と下位半分とに分け
て出力可能な浮動小数点演算器の仮数部演算回路、4は
浮動小数点乗算器の仮数部演算回路3の出力の上位半
分、5は浮動小数点乗算器3の仮数部演算回路の出力の
下位半分、6は選択回路、7は選択回路の出力、8は選
択信号、9は正規化回路、10は正規化回路の出力であ
る。
FIG. 1 is a block diagram of a random number generator of the embodiment. 1 is the first mantissa arithmetic circuit of the floating point multiplier
Input 2 is the second input of the mantissa arithmetic circuit of the floating point multiplier, and 3 is the mantissa arithmetic circuit of the floating point arithmetic unit that can output the upper half and the lower half of the output bits separately. The upper half of the output of the mantissa arithmetic circuit 3 of the decimal point multiplier, 5 is the lower half of the output of the mantissa arithmetic circuit of the floating point multiplier 3, 6 is the selection circuit, 7 is the output of the selection circuit, 8 is the selection signal, Reference numeral 9 is a normalization circuit, and 10 is an output of the normalization circuit.

【0010】図1の乱数発生装置の動作について説明す
る。先ず、乗算合同法について説明する。乗算合同法に
よる乱数の発生は以下の式による(林知己夫著、「乱数
の知識」、森北出版参照)。
The operation of the random number generator of FIG. 1 will be described. First, the congruential multiplication method will be described. Random numbers are generated by the congruential multiplication method according to the following formula (see Tomoki Hayashi, "Knowledge of Random Numbers", Morikita Publishing).

【0011】 Xn+1 ≡a×Xn (modulo 2p )...(1) X0 =b (a=3,5(modulo 8),b=奇数) ここで、Xn は2進数でp桁の乱数列、aはその初期値
である。また、modulo 2p は任意の整数を2p
で割ったときの剰余を意味する。
X n + 1 ≡a × X n (modulo 2 p ). . . (1) X 0 = b (a = 3, 5 (modulo 8), b = odd number) Here, X n is a binary p-digit random number sequence, and a is its initial value. Also, modulo 2 p is an arbitrary integer 2 p
It means the remainder when divided by.

【0012】図1の乱数発生装置を用いて乱数を発生す
る場合、浮動小数点乗算器の仮数部演算回路3の第1入
力1に、上記式(1)の記号aに相当する数を整数の形
式で与える。また、浮動小数点乗算器の仮数部演算回路
3の第2入力2に、上記式(1)の記号Xn に相当する
数すなわち直前に発生した乱数を整数の形式で与える。
すわなち、これらは必ずしも浮動小数点演算用に正規化
されていない場合もある。これらは共にNビット長の2
進数である。したがって、仮数部演算回路3は2*Nビ
ットの乗算結果を出力する。この上位Nビットが出力4
であり、下位Nビットが出力5である。
When a random number is generated by using the random number generator of FIG. 1, a number corresponding to the symbol a in the above formula (1) is set to an integer in the first input 1 of the mantissa arithmetic circuit 3 of the floating point multiplier. Give in format. In addition, the second input 2 of the mantissa arithmetic circuit 3 of the floating point multiplier is given the number corresponding to the symbol X n in the above formula (1), that is, the random number generated immediately before, in the form of integer.
That is, they may not always be normalized for floating point arithmetic. Both of these are N-bit long, 2
It is a decimal number. Therefore, the mantissa arithmetic circuit 3 outputs the multiplication result of 2 * N bits. This upper N bit is output 4
And the lower N bits are output 5.

【0013】通常の浮動小数点乗算においては、仮数部
演算回路3の出力として上位Nビットの出力4が出力さ
れる。しかし、乱数発生においては式(1)から乗算結
果として下位Nビットの出力5を選択する必要がある。
この選択を選択信号8と選択回路6を用いて行なう。す
なわち、使用者或いはプログラムの指示に基づいて選択
信号8を発生させ、通常の浮動小数点乗算器として動作
させるときは上位Nビットを選択し、乱数を発生させる
ときは下位Nビットを選択する。選択回路6の出力7は
必ずしも正規化されていないので、これを浮動小数点演
算で利用するために正規化回路9で正規化する。しか
し、選択回路6の出力7は式(1)からまた次の乱数発
生に用いるのでそのままの形で保存しておく必要があ
る。これが出力信号7’である。
In normal floating point multiplication, the output 4 of the upper N bits is output as the output of the mantissa arithmetic circuit 3. However, in the random number generation, it is necessary to select the output N of the lower N bits as the multiplication result from the equation (1).
This selection is performed using the selection signal 8 and the selection circuit 6. That is, the selection signal 8 is generated based on the instruction of the user or the program, and the upper N bits are selected when operating as a normal floating point multiplier, and the lower N bits are selected when generating a random number. Since the output 7 of the selection circuit 6 is not necessarily normalized, it is normalized by the normalization circuit 9 in order to use it in the floating point arithmetic. However, since the output 7 of the selection circuit 6 is used for the next random number generation from the equation (1), it needs to be stored as it is. This is the output signal 7 '.

【0014】[0014]

【発明の効果】以上で説明したように本発明によれば、
最小限のハードウェアを付加するだけで既存の浮動小数
点乗算器を利用して、乗算合同法を用いて乱数を高速に
発生することができる。
As described above, according to the present invention,
It is possible to generate random numbers at high speed by using the congruential multiplication method by using the existing floating-point multiplier by adding the minimum hardware.

【図面の簡単な説明】[Brief description of drawings]

【図1】 本発明に係わる浮動小数点乗算器を用いた乱
数発生装置のブロック図である。
FIG. 1 is a block diagram of a random number generator using a floating point multiplier according to the present invention.

【図2】 従来の浮動小数点乗算器のブロック図であ
る。
FIG. 2 is a block diagram of a conventional floating point multiplier.

【符号の説明】[Explanation of symbols]

1…仮数部演算回路の第1入力、2…仮数部演算回路の
第2入力、3…仮数部演算回路、4…仮数部演算回路の
出力の上位半分、5…仮数部演算回路の出力の下位半
分、6…選択回路、7…選択回路の出力、8…選択信
号、9…正規化回路、10…正規化回路の出力
1 ... First input of mantissa arithmetic circuit, 2 ... Second input of mantissa arithmetic circuit, 3 ... Mantissa arithmetic circuit, 4 ... Upper half of output of mantissa arithmetic circuit, 5 ... Output of mantissa arithmetic circuit Lower half, 6 ... Selection circuit, 7 ... Selection circuit output, 8 ... Selection signal, 9 ... Normalization circuit, 10 ... Normalization circuit output

Claims (1)

【特許請求の範囲】[Claims] 【請求項1】 仮数部演算回路の出力ビットの内の上位
半分と下位半分とに分けて出力可能な浮動小数点乗算器
と、前記仮数部演算回路の出力ビットの内の上位半分を
とるか下位半分をとるかを選択する選択回路とを備えた
ことを特徴とする乱数発生装置。
1. A floating point multiplier capable of separately outputting the upper half and the lower half of the output bits of the mantissa arithmetic circuit, and taking the upper half of the output bits of the mantissa arithmetic circuit or taking the lower half. A random number generator comprising: a selection circuit for selecting whether to take half.
JP4239816A 1992-09-08 1992-09-08 Random number generator Pending JPH0689163A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP4239816A JPH0689163A (en) 1992-09-08 1992-09-08 Random number generator

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP4239816A JPH0689163A (en) 1992-09-08 1992-09-08 Random number generator

Publications (1)

Publication Number Publication Date
JPH0689163A true JPH0689163A (en) 1994-03-29

Family

ID=17050277

Family Applications (1)

Application Number Title Priority Date Filing Date
JP4239816A Pending JPH0689163A (en) 1992-09-08 1992-09-08 Random number generator

Country Status (1)

Country Link
JP (1) JPH0689163A (en)

Similar Documents

Publication Publication Date Title
JPS6131489B2 (en)
US5317528A (en) Random number generator
EP1876523A1 (en) Computation of A MOD (2^n - 1)
JP4566513B2 (en) Method and apparatus for generating pseudo-random sequences
JP2950485B2 (en) Stream cipher processor
KR20050065976A (en) Apparatus and method for computing sha-1 hash function
JPH08107366A (en) Inversion circuit of a finite body origin
JPH0689163A (en) Random number generator
JPH0342715A (en) Approximated inverse number generation device for division
JP3913921B2 (en) Circuit for reciprocal of arbitrary element in finite field
KR960018874A (en) Multiplier and digital filter
KR0147942B1 (en) Booths recording circuit in a multiplier
JP2991788B2 (en) Decoder
JP3097081B2 (en) Variable stage m-sequence code generator
JP3895887B2 (en) Decibel level adjustment device
JP2797773B2 (en) Reciprocal arithmetic unit
JPH06274319A (en) Random number generation device
JP2972926B2 (en) Modulation circuit and sound generator
JPH09101877A (en) Operation method and device for multipilcation
JPH01265609A (en) Pseudo random number generator
JPH09325882A (en) Uniform random number generation circuit
JPH08305551A (en) Random number generator
JPH0695854A (en) Division arithmetic unit
JP3722821B2 (en) Calculation method
JPH0883167A (en) Random number generation circuit