JPS6146524A - Pseudo random number generating device - Google Patents

Pseudo random number generating device

Info

Publication number
JPS6146524A
JPS6146524A JP59168956A JP16895684A JPS6146524A JP S6146524 A JPS6146524 A JP S6146524A JP 59168956 A JP59168956 A JP 59168956A JP 16895684 A JP16895684 A JP 16895684A JP S6146524 A JPS6146524 A JP S6146524A
Authority
JP
Japan
Prior art keywords
bits
random number
register
contents
stored
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.)
Granted
Application number
JP59168956A
Other languages
Japanese (ja)
Other versions
JPH0332812B2 (en
Inventor
Makoto Tajo
誠 田場
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.)
NEC Corp
Original Assignee
NEC Corp
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 NEC Corp filed Critical NEC Corp
Priority to JP59168956A priority Critical patent/JPS6146524A/en
Publication of JPS6146524A publication Critical patent/JPS6146524A/en
Publication of JPH0332812B2 publication Critical patent/JPH0332812B2/ja
Granted legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/58Random or pseudo-random number generators
    • G06F7/582Pseudo-random number generators
    • G06F7/584Pseudo-random number generators using finite field arithmetic, e.g. using a linear feedback shift register
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2207/00Indexing scheme relating to methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F2207/58Indexing scheme relating to groups G06F7/58 - G06F7/588
    • G06F2207/581Generating an LFSR sequence, e.g. an m-sequence; sequence may be generated without LFSR, e.g. using Galois Field arithmetic
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2207/00Indexing scheme relating to methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F2207/58Indexing scheme relating to groups G06F7/58 - G06F7/588
    • G06F2207/583Serial finite field implementation, i.e. serial implementation of finite field arithmetic, generating one new bit or trit per step, e.g. using an LFSR or several independent LFSRs; also includes PRNGs with parallel operation between LFSR and outputs

Abstract

PURPOSE:To generate a pseudo random number whose uniformity having reproducibility is verified sufficiently at a high speed by providing a random number generation instruction which generates a pseudo random number using an (m) sequence and executing it through hardware. CONSTITUTION:The random number generation instruction consists of an operand code OP, general register specifying field GR, and address syllable AS. The lower 64 bits of an initial value Y0 (128 bits) read out of a memory 1 are shifted by one bit to right to obtain Y1, which is ORed exclusively with the lower 63 bits of Y0 by ALU9 to obtain Y2, which is registered as a generated random value in a general register having a number specified by the GR field of an instruction word. Bits 1-64 of the Y2 and Y0 are concatenated to obtain 16-byte data, which is stored in an address X to finish the execution of the instruction. The high-order bits 1-31 (stored in general register) of the random number value Y2 generated as mentioned above are used a fixed-point number.

Description

【発明の詳細な説明】 技術分野 本発明は擬似乱数発生装置に関し、特に算術的に発生さ
れる擬似乱数のうち発生頻度及び発生間隔が一様分布に
従う一様乱数を発生する最大長系列(m系列)を用いた
2進数擬似乱数発生装置に関する。
Detailed Description of the Invention Technical Field The present invention relates to a pseudorandom number generator, and in particular to a maximum length sequence (m This invention relates to a binary pseudorandom number generator using a binary number sequence.

従来技術 電子計算機を用いて大規模なモンテカルロ実験等のシミ
ュレーションを行う場合に必要な大量の乱数の供給には
、算術的乱数が用いられる。
BACKGROUND OF THE INVENTION Arithmetic random numbers are used to supply a large amount of random numbers required when performing simulations such as large-scale Monte Carlo experiments using conventional electronic computers.

従来においては、0〜2n(nは2以上の整数)の範囲
内における整数の乱数発生の・・−ドウエア手段として
2nの可能な状態を取り得るn段のリングカウンタが知
られている。しかしな□がら、リングカウンタによって
得られる擬似乱数は周期も短くまた亦布も一様でなく一
様乱数としては見なし難いので、精密なシミュレーショ
ンには不適当であった。
Conventionally, an n-stage ring counter capable of assuming 2n possible states has been known as a hardware means for generating random integers within the range of 0 to 2n (n is an integer of 2 or more). However, the pseudo-random numbers obtained by the ring counter have a short period and are not uniformly distributed, making it difficult to regard them as uniform random numbers, making them unsuitable for precise simulations.

ソフトウェア手段としては、古くから利用されているも
のに合同法による乱数発生があシ、自然数819%整数
すを適当に定め非負の初期値(整数) 2iQを与えて
、漸化式 %式%(1) によって″乱数列″Z6 、ZI 、ic41・・・を
作り出している。
As a software means, one that has been used for a long time is random number generation using the congruence method, and by appropriately setting a natural number 819% integer and giving a non-negative initial value (integer) 2iQ, the recurrence formula % formula % ( 1) "Random number sequences" Z6, ZI, ic41, etc. are created by the following.

しかし合同法によって発生される数列には周期性があり
、その周期はp以下であシ、使用する計算機で表現でき
る最大の数に1を加えたものをpとしても使用する計算
機のけた数によって制約を受けてしまう。また、数列の
一周期分には同一の数が現われることがない為、多次元
分布を作るような場合、(”0 、r、+ 、”’、z
n−1 )  + (xn  ”n+1゜・・・、ろ。
However, the number sequence generated by the congruence method has periodicity, and the period must be less than or equal to p, and p is the maximum number that can be expressed by the computer used, plus 1, and is determined by the number of digits of the computer used. You will be subject to restrictions. Also, since the same number never appears in one cycle of the sequence, when creating a multidimensional distribution, ("0, r, +, "', z
n-1) + (xn ”n+1゜..., ro.

−1)、・・・を座標とする点はn次元(超)立方体内
のpnの格子点のうち高々2個にしか配置されず、しか
もn次元空間におけるとれらの点の分布はランダムでは
なく、(n 、/ p )/n枚以下の超平面上にのっ
てしまう規則性をもつので、合同法によ多発生した乱数
が多次元の分布を作る場合には不適当となることが多か
った。
-1), ... are located at at most two of the pn lattice points in the n-dimensional (hyper)cube, and the distribution of these points in the n-dimensional space is not random. It has a regularity that it lies on a hyperplane of less than (n, /p)/n sheets, so it is inappropriate when the random numbers generated by the congruence method create a multidimensional distribution. There were many.

その他にソフトウェア手段として最大周期列(以下、m
系列と略す)を用いた一様乱数の発生方法がある。m系
列を用いた乱数発生方法を簡略に述べると、 定数c、、c2.・・・+Cplがいずれも0まだは1
でcp=lであるとして、漸化式 %式%) によって作シ出される0と1からなる数列(al)を考
える。ただし初期値aOr al +用+ ap 、1
はすべてがOではないように選ぶものとする。alの値
は順列(ai r + ai 21 ”’l ai−p
)によって−意に定まり、相異なる順列の個数は2p−
1であるから、数列(al)の周期mは2p−1を超え
ないことは明らかである。ちょうどm=211”となる
だめの条件は、特性多項式 %式%(22 がガロア体G F (2)上の原始多項式であることで
ある。また、このとき(al)を最大周期列(maxi
mum−1angth 1inearly recur
ringsequence 、略してm系列)と呼ぶ。
In addition, as a software means, the maximum periodic sequence (hereinafter m
There is a method of generating uniform random numbers using a random number sequence. To briefly describe the random number generation method using m-sequences, constants c, , c2 . ...+Cpl are both 0 and still 1
Assuming that cp=l, consider a sequence (al) consisting of 0 and 1 produced by the recurrence formula %). However, the initial value aOr al + for + ap, 1
shall be chosen so that all are not O. The value of al is permutation (air + ai 21 ”'l ai-p
), the number of different permutations is 2p-
1, it is clear that the period m of the sequence (al) does not exceed 2p-1. The condition for exactly m=211'' is that the characteristic polynomial %(22) is a primitive polynomial on the Galois field G F (2). Also, in this case, (al) is the maximum periodic sequence (maxi
mum-1angth 1inearly recur
It is called a ring sequence (m-sequence for short).

さて、Tausworthはm系列〔al)から相続く
t(≦p)個の数を取り出してきて並べ、tビットの2
進lJ\数 ”k”’ (La(7に+r+I 、a(Fk+r+2
°−B6に+、+t−−− (2−3)を作シ、系列(
uk)を区間(0,1)上の一様乱数として使うことを
提案した。ここに、rは非負の任意の整数であり、σ(
≧t)は(al)から次々にtビットずつ取り出す間隔
である。σを(a、)の周期mと互いに素になるように
選ぶと、(uk)の周期もmとなる。そしてその1周期
には、0が2Pl−1回、その他のあらゆるtビットの
2進少数が2p−tずつ現われる。したがってp−tが
ちまり/)へさくなければ、(uk)は(少なくとも頻
度に関しては)はぼ一様分布に従っているものと見なせ
る。Tauswortheさらに、(uk)の自己相関
は、遅れが(m−t)/σ以下ならば理想的な一様乱数
のものとほとんど一致すること、また次元がp/σ以下
ならば、多次元分布もほぼ一様分布になることを理論的
に示した。
Now, Tausworth extracts t (≦p) successive numbers from the m sequence [al], arranges them, and arranges the t-bit 2
Hexadecimal lJ\number “k”’ (La(+r+I to 7, a(Fk+r+2
Create +, +t--- (2-3) on °-B6, series (
uk) as a uniform random number on the interval (0,1). Here, r is any non-negative integer and σ(
≧t) is the interval at which t bits are successively extracted from (al). If σ is chosen to be coprime to the period m of (a,), then the period of (uk) will also be m. In one period, 0 appears 2Pl-1 times and all other t-bit binary digits appear 2p-t times. Therefore, if pt does not decrease to /), it can be assumed that (uk) (at least in terms of frequency) follows an approximately uniform distribution. Furthermore, if the delay is less than or equal to (m-t)/σ, the autocorrelation of (uk) almost matches that of an ideal uniform random number, and if the dimension is less than or equal to p/σ, then the autocorrelation of (uk) is a multidimensional distribution. It was theoretically shown that the distribution is almost uniform.

このようにTauswortheの方法は、それによっ
て得られる数列のいろいろな性質が理論的にわかってい
るという意味で大変に優れているが、乱数を1個発生す
るのに要する時間が、例えば合同法と比べると、はる力
宅長い欠点を有している。
In this way, Tausworth's method is very superior in the sense that the various properties of the number sequence obtained by it are known theoretically, but the time required to generate one random number is longer than that of the congruential method, for example. In comparison, Harukiya has long drawbacks.

そこでLewis & PayneはTauswort
he (D方法を改良して、短時間に乱数を発生する方
法を考案した。まず原始多項式として3環式 f (z)−zp+ zq+ 1      川・・曲
(2,4)を選ぶ(p’>q)。したがって、(ai)
を作り出す漸化式は al = ai 、 + ai−Q (mod 2)曲
・−−・(2,5)となる。そして、(ai)から(U
、)を作るのには、uk= 0.akak+r +・+
 ak+ (t −+ ) r ・・曲(2,6)とす
る。ここkt≦pで、rは周期mと互いに素な整数であ
る。この方法の特徴は、(ai)から取ってきた数を(
2,3)のように横(行方向)″ではなくて、“縦(列
方向)″に並べるもので、隣り合う各列間ではrずつ位
相をずらしているところにある。
So Lewis & Payne decided to use Tauswort.
he (I improved the D method and devised a method to generate random numbers in a short time. First, select the tricycle f (z) - zp + zq + 1 river... song (2, 4) as a primitive polynomial (p'>q).Therefore, (ai)
The recurrence formula that creates al = ai, + ai-Q (mod 2) song -- (2, 5). And from (ai) to (U
, ), uk=0. akak+r +・+
ak+ (t −+ ) r . . . song (2, 6). Here, kt≦p, and r is an integer coprime to the period m. The feature of this method is that the number taken from (ai) is
They are arranged vertically (column direction) rather than horizontally (row direction) as in 2 and 3), and the phase is shifted by r between adjacent columns.

原始3多項式はきわめてたくさんのものが知られている
のでp、qの選択の自由度は大きい。このうちで2”−
1が素数となるものを選ぶと、他のパラメータの値を周
期と互いに素となるように選ぶ心配をしなくてもすむの
で好都合となる。この方法による乱数の発生が速いのは
次の理由による。
Since a large number of primitive 3 polynomials are known, there is a large degree of freedom in selecting p and q. Of these, 2”-
Choosing one for which 1 is a prime number is advantageous because it eliminates the need to worry about choosing values of other parameters so that they are coprime to the period. The reason why this method generates random numbers quickly is as follows.

漸化式(2,5)の演算は繰り上りなしの足し算である
から、排他的論理和と同じであり、したがって(uk 
)は関係式 %式%(27) によって作り出すことができるのである。
Since the operation of recurrence formula (2, 5) is addition without carry, it is the same as exclusive OR, and therefore (uk
) can be created using the relational expression % (27).

発明の目的 本発明は、熱雑音等の再現性を有さない物理現象を用い
ることなく、ハードウェアにょシ高度の一様性を有する
擬似乱数列を高速に発生し得る擬似乱数発生装置を提供
することを目的としている。
Purpose of the Invention The present invention provides a pseudorandom number generator capable of rapidly generating a pseudorandom number sequence with a high degree of uniformity in hardware without using physical phenomena that do not have reproducibility such as thermal noise. It is intended to.

発明の構成 本発明による擬似乱数発生装置は、原始多項式f (x
)= Zp+ zq+ 1によるm系列を用いたnビッ
トの2進擬似乱数を発生する装置であって、命令語で指
定された主記憶アドレスからpビットを読出す手段と、
このpビットの内容を初期値として一時的にこれを保持
する手段と、このpビットの内容ヲp −qビットシフ
トするシフト手段と、このシフト結果のmビットの内容
と当該保持されたpビット中の連続するmビットの内容
とをビット毎に排他的論理和をとする排他的論理和手段
と、この排他的論理和結果のmビットの内容を上位mビ
ットとし当該保持されたpビットの上位p−mビットの
内容を下位p−mビットとした合計pビットの内容を命
令語で指定された主記憶アドレスへ書込む手段と、排他
的論理和手段の出力からnビットを導出する手段とを含
む構成である。
Structure of the Invention The pseudo-random number generator according to the present invention has a primitive polynomial f (x
)=Zp+zq+1 A device for generating an n-bit binary pseudo-random number using an m-sequence of 1, the device comprising means for reading p bits from a main memory address specified by a command word;
means for temporarily holding the contents of this p bit as an initial value; a shifting means for shifting the contents of this p bit by p -q bits; and a means for temporarily holding the contents of this p bit as an initial value; an exclusive OR means that performs an exclusive OR bit by bit with the contents of consecutive m bits in Means for writing the contents of a total of p bits, including the contents of the upper pm bits and the lower pm bits, to the main memory address specified by the instruction word, and means for deriving n bits from the output of the exclusive OR means. The configuration includes the following.

更に述べれば、本発明の特徴は、初期状態の設定と乱数
生成アルゴリズムとにより、算術的に再現性の有する擬
似乱数を発生させる情報処理装置において、命令語から
直接まだは間接に指定された主記憶アドレスから初期値
を読出し、この読み出された初期値をあらかじめ定めら
れたビット数だけシフトし、この読み出された初期値と
シフトされた値とからビット毎の排他的論理和を作り、
この値から第1のあらかじめ定められた桁数を抜き出し
て、命令語で指定されたソフトウェアビジプルレジスタ
に格納し、前述の発生された排他的論理和値から第2の
あらかじめ定められた桁数を抜き出した値と当該初期値
から第3のあらかじめ定められた桁数を抜き出した値と
を連接して主記憶アドレスに格納して次回の乱数発生の
初期値とすることにある。
More specifically, a feature of the present invention is that in an information processing device that generates pseudorandom numbers that are arithmetically reproducible by setting an initial state and using a random number generation algorithm, reads an initial value from a storage address, shifts this read initial value by a predetermined number of bits, creates a bit-wise exclusive OR from this read initial value and the shifted value,
A first predetermined number of digits is extracted from this value and stored in a software visible register specified by the instruction word, and a second predetermined number of digits is extracted from the generated exclusive OR value. The extracted value and the value extracted by extracting a third predetermined number of digits from the initial value are concatenated and stored in the main memory address to be used as the initial value for the next generation of random numbers.

実施例 以下、図面を用いて本発明の詳細な説明する。Example Hereinafter, the present invention will be explained in detail using the drawings.

第1図は本発明の実施例のだめの乱数発生命令の形式で
あり、OPはオペコードであって乱数発生命令固有のオ
ペコードが割付けられる。GRは汎用レジスタ指定フィ
ールドであって、発生された固定小数点乱数を格納すべ
きGR(汎用レジスタ)を指定する。ASはアドレスシ
ラブルであって、通常のアドレス展開によりASの指示
する先頭バイトから16バイトの初期値が読出され、ま
た同アドレスに実行結果が次の乱数発生のだめの初期値
として格納される。
FIG. 1 shows the format of a random number generation instruction according to an embodiment of the present invention, where OP is an operation code and an operation code unique to the random number generation instruction is assigned. GR is a general-purpose register specification field, and specifies the GR (general-purpose register) in which the generated fixed-point random number is to be stored. AS is an address syllable, and by normal address expansion, an initial value of 16 bytes is read from the first byte indicated by AS, and the execution result is stored at the same address as an initial value for the next random number generation.

第2図は本発明の実施例のブロック図であり、1はメモ
リ、2及び3はメモリリードレジスタを示す。4はソフ
トウェアビジプルレジスタであり、ソフトウェアから読
書き、演算の対象として指定できるレジスタであって計
算機の命令の対象となるレジスタである。このソフトウ
ェアビジプルレジスタ4は、ベース(基底)レジスタ(
BR)  とゼネラル(汎用)レジスタ(GR)と更に
は科学演算レジスタ(SR)とからなっている。
FIG. 2 is a block diagram of an embodiment of the present invention, in which 1 represents a memory, and 2 and 3 represent memory read registers. Reference numeral 4 denotes a software visible register, which is a register that can be specified as a target of operations by reading and writing from software, and is a register that is a target of computer instructions. This software visible register 4 is a base register (
It consists of a general register (GR), a general register (BR), and a scientific operation register (SR).

5及び6はオペランド1セレクタ及びオペランド2セレ
クタを夫々示し、まだ7及び8はオペランドルレジスタ
及びオペランド2レジスタを夫々示している。これ等両
レジスタ7及び8の内容を夫々入力とするALU (演
算論理ユニット)9とシック10とが設けられており、
両ALU 9とシフタ10との出力は演算結果セレクタ
11及びオペランド1,2セレクタ5及び6の各入力と
なっている。
5 and 6 indicate the operand 1 selector and operand 2 selector, respectively, and 7 and 8 indicate the operand register and operand 2 register, respectively. An ALU (arithmetic logic unit) 9 and a chic 10 are provided which receive the contents of these registers 7 and 8, respectively.
Outputs from both ALUs 9 and shifter 10 serve as inputs to arithmetic result selector 11 and operand 1, 2 selectors 5 and 6, respectively.

セレクタ11による出力は演算結果レジスタ12へ格納
され、この格納出力はメモリ1及びソフトウェアビジプ
ルレジスタ4へ入力されている。
The output from the selector 11 is stored in the operation result register 12, and this stored output is input to the memory 1 and the software visible register 4.

第3図は第2図の装置の動作による乱数発生命令実行前
と実行後とのメモリの内容の変化を示した模式的図であ
り、第4図は本発明の実施例の動作フローを示す図であ
る。
FIG. 3 is a schematic diagram showing changes in the contents of the memory before and after execution of the random number generation instruction due to the operation of the device shown in FIG. 2, and FIG. 4 shows the operational flow of the embodiment of the present invention. It is a diagram.

以下、p=127.q=1として動作を順次説明する。Below, p=127. The operation will be sequentially explained assuming q=1.

先ず、命令語が読出されてOPコードのデコードにより
、乱数発生命令であることが認識されると、命令語のA
Sが展開された後、絶対アドレス変換されて主記憶装置
1の指定されたアドレスから連続する16バイト(12
8ビツト)の初期値が読出される。このとき、例えばメ
モリ1から最初の8バイト(ビットO〜63)が読出さ
れてメモリ読出レジスタ2へ格納され、次に続く8バイ
ト(ビット64〜127)がメモリ1から読出されてメ
モリ読出レジスタ3へ格納される。よって、両レジスタ
2及び3の内容が第4図におけるYoの値に相当するこ
とになる。
First, when the instruction word is read and it is recognized by decoding the OP code that it is a random number generation instruction, the A of the instruction word is
After S is expanded, the absolute address is converted and 16 consecutive bytes (12
8 bits) is read out. At this time, for example, the first 8 bytes (bits 0 to 63) are read from memory 1 and stored in memory read register 2, and the next 8 bytes (bits 64 to 127) are read from memory 1 and stored in memory read register 2. 3. Therefore, the contents of both registers 2 and 3 correspond to the value of Yo in FIG.

そして、オペランドルジスタフをクリヤ(0をこのレジ
スタ7に格納)すると共に、オペランド2セレクタ6を
通してメモリ読出レジスタ3の内容をオペランド2レジ
スタ8へ移送する。両レジスタ7及び8を入力とするシ
ック10において、左63ビツトのシフトを行わせてこ
のシフト結果を演算結果セレクタ11を通して演算結果
レジスタ12へ格納する。この時のレジスタ12の内容
が第4図のYlとなる。尚、第4図の7(1)はOを内
容とする1ビツトを示している。
Then, the operand register 7 is cleared (0 is stored in this register 7), and the contents of the memory read register 3 are transferred to the operand 2 register 8 through the operand 2 selector 6. In the chic 10, which receives both registers 7 and 8 as input, a 63-bit shift is performed to the left, and the shift result is stored in the operation result register 12 through the operation result selector 11. The contents of the register 12 at this time become Yl in FIG. Note that 7(1) in FIG. 4 indicates 1 bit whose content is O.

次に、オペランドルジスタフ及びオペランド2レジスタ
8を入力とするシフタにより左65ビツトのシフトを行
い、そのシフト結果をオペランドルジスタフへ格納する
。まだ、演算結果レジスタ12がオペランドルジスタフ
へ移送すると共に、両レジスタ7及び8の内容を右2ビ
ツトシフトしてその結果をオペランド2レジスタ8に格
納する。しかる後に、ALU9にて両レジスタ7及び8
のビット毎の排他的論理和演算を行わせ、第4図のY2
を得てこれをレジスタ12へ格納スる。
Next, a shift of 65 bits to the left is performed by a shifter having the operand register 8 and operand 2 register 8 as inputs, and the shift result is stored in the operand register 8. Still, the operation result register 12 is transferred to the operand register 8, and the contents of both registers 7 and 8 are shifted to the right by 2 bits, and the result is stored in the operand 2 register 8. After that, both registers 7 and 8 are set in ALU9.
Exclusive OR operation is performed for each bit of Y2 in FIG.
is obtained and stored in the register 12.

このレジスタ12からソフトウェアビジプルレジスタ4
の汎用レジスタ(GR)へY2の上位32ビツトを格納
し、また演算結果レジスタ12のY2をメモリ1の上位
8バイ)(0:64)へ格納すると共にメモリ読出レジ
スタ2からオペランドルジスタフへ、レジスタ3からレ
ジスタ8へ夫々移送する。
From this register 12 to software visible register 4
The upper 32 bits of Y2 are stored in the general-purpose register (GR) of , and Y2 of the operation result register 12 is stored in the upper 8 bytes of memory 1 (0:64), and from the memory read register 2 to the operand database. Transfer from register 3 to register 8, respectively.

、t こ\では、Yoが両オペランド1,2レジスタ弘へ移る
ことになる。
, t In this case, Yo moves to both operands 1 and 2 registers.

両レジスタ7.8の内容をシフタ10にて左へ1ビツト
シフトしてYo(1:64)ヲレシスタ12Kiること
になる。このレジスタ12の内容をメモリ1の下位8バ
イトへ格納するのである。
The contents of both registers 7 and 8 are shifted 1 bit to the left by the shifter 10, resulting in a Yo (1:64) register 12Ki. The contents of this register 12 are stored in the lower 8 bytes of memory 1.

以上の動作を要約すると第3図に示す如きものとなり、
メモリから読出された初期値Yo(128ビツト)の下
64ビットを右に1ビツトシフトしてyとし、Yoの下
63ビットとYlとの排他的論理和をとってこれをY2
とし、このY2を発生された乱数値として命令語のGR
フィールドにて指定された番号の汎用レジスタへ格納す
る。Y2とY。のビット1〜64とを連接して16バイ
ト長のデータとしてアドレスXに格納して命令実行の終
了となる。
The above operation can be summarized as shown in Figure 3,
The lower 64 bits of the initial value Yo (128 bits) read from the memory are shifted 1 bit to the right and set as y, and the lower 63 bits of Yo are exclusive ORed with Yl and this is set as Y2.
Let Y2 be the generated random value and GR of the instruction word.
Store in the general-purpose register with the number specified in the field. Y2 and Y. bits 1 to 64 are concatenated and stored as 16-byte data at address X, and instruction execution ends.

今回発生した乱数値Y2のうち例えば上位ビット1〜ビ
ツト31(汎用レジスタに格納されている)を固定小数
点乱数として使用することになる。
For example, high-order bits 1 to 31 (stored in a general-purpose register) of the random value Y2 generated this time are used as a fixed-point random number.

本実施例では、(2,4)式のp = 127. q 
=1とした原始多項式 %式%(31) を使用しており、 ai ”” ai−127■at −126−−−−°
= (3、2)の漸化式により擬似乱数を発生させるこ
とになる。。
In this example, p = 127. of equation (2, 4). q
The primitive polynomial % formula % (31) with = 1 is used, and ai "" ai-127■at -126-----°
Pseudo-random numbers are generated by the recurrence formula = (3, 2). .

発明の効果 紙上の如く、本発明によれば、m系列を用いた擬似乱数
を発生する乱数発生命令を設けてこれを・・−ドウエア
によシ実行することによシ、再現性を有する一様性が十
分に検証された擬似乱数を、ソフトウェアにて発生させ
るよりもより高速にて発生可能となる。
Effects of the Invention As described in the paper, according to the present invention, by providing a random number generation instruction for generating pseudo-random numbers using an m-sequence and executing this by software, a reproducible number can be obtained. Pseudo-random numbers whose properties have been fully verified can be generated faster than by software.

【図面の簡単な説明】[Brief explanation of the drawing]

第1図は本発明の実施例の乱数発生命令の命令語のフォ
ーマットを示す図、第2図は本発明の実施例のブロック
図、第3図は本発明の実施例の命令実行前後のメモリ内
容の変化と乱数発生の様子を示す図、第4図は本発明の
実施例の命令動作のフローチャートである。 主要部分の符号の説明 1・・メモリ 2.3・・・メモリ読出レジスタ 4・・・ソフトウェアビジプルレジスタ7.8・・・オ
ペランドレジスタ 9・・・A L U      10・・・シフタ12
・・・演算結算レジスタ
FIG. 1 is a diagram showing the format of the instruction word of the random number generation instruction according to the embodiment of the present invention, FIG. 2 is a block diagram of the embodiment of the present invention, and FIG. 3 is a diagram showing the memory before and after execution of the instruction according to the embodiment of the present invention. FIG. 4, which is a diagram showing changes in content and how random numbers are generated, is a flowchart of command operations according to an embodiment of the present invention. Explanation of symbols of main parts 1...Memory 2.3...Memory read register 4...Software visible register 7.8...Operand register 9...ALU 10...Shifter 12
... Arithmetic calculation register

Claims (1)

【特許請求の範囲】[Claims] 原始多項式f(x)=x^p+x^q+1(p、qはp
>q≧1なる整数)による最大長系列を用いたn(0<
n≦p)ビットの2進擬似乱数を発生する装置であつて
、命令語で指定された主記憶アドレスからpビットを読
出す手段と、このpビットの内容を初期値として一時的
にこれを保持する手段と、前記pビットの内容をp−q
ビットシフトするシフト手段と、このシフト結果のm(
m≧n)ビットの内容と前記保持されたpビット中の連
続するmビットの内容とをビット毎に排他的論理和をと
る排他的論理和手段と、この排他的論理和結果のmビッ
トの内容を上位mビットとし前記保持されたpビットの
上位p−mビットの内容を下位のp−mビットとした合
計pビットの内容を命令語で指定された主記憶アドレス
へ書込む手段と、前記排他的論理和手段の出力からnビ
ットを導出する手段とを含むことを特徴とする擬似乱数
発生装置。
Primitive polynomial f(x)=x^p+x^q+1 (p, q are p
n(0<
A device for generating a binary pseudo-random number of (n≦p) bits, which includes a means for reading p bits from a main memory address specified by a command word, and a means for temporarily reading out p bits using the contents of the p bits as an initial value. means for retaining the contents of the p bits as p-q;
Shifting means for bit shifting and m(
m≧n) bits and the contents of successive m bits among the retained p bits, exclusive OR means for bit by bit, and m bits of this exclusive OR result; means for writing the contents of a total of p bits into the main memory address specified by the instruction word, with the contents being the upper m bits and the contents of the upper p-m bits of the held p bits being the lower p-m bits; and means for deriving n bits from the output of the exclusive OR means.
JP59168956A 1984-08-13 1984-08-13 Pseudo random number generating device Granted JPS6146524A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP59168956A JPS6146524A (en) 1984-08-13 1984-08-13 Pseudo random number generating device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP59168956A JPS6146524A (en) 1984-08-13 1984-08-13 Pseudo random number generating device

Publications (2)

Publication Number Publication Date
JPS6146524A true JPS6146524A (en) 1986-03-06
JPH0332812B2 JPH0332812B2 (en) 1991-05-14

Family

ID=15877668

Family Applications (1)

Application Number Title Priority Date Filing Date
JP59168956A Granted JPS6146524A (en) 1984-08-13 1984-08-13 Pseudo random number generating device

Country Status (1)

Country Link
JP (1) JPS6146524A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004505289A (en) * 1999-12-02 2004-02-19 ハネウェル・インターナショナル・インコーポレーテッド Computer efficient linear feedback shift register.

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004505289A (en) * 1999-12-02 2004-02-19 ハネウェル・インターナショナル・インコーポレーテッド Computer efficient linear feedback shift register.
JP4828068B2 (en) * 1999-12-02 2011-11-30 ハネウェル・インターナショナル・インコーポレーテッド Computer efficient linear feedback shift register

Also Published As

Publication number Publication date
JPH0332812B2 (en) 1991-05-14

Similar Documents

Publication Publication Date Title
Marsaglia et al. A new class of random number generators
US5199073A (en) Key hashing in data processors
US4161041A (en) Pseudo random number generator apparatus
EP0066768A1 (en) Apparatus for generation of random numbers
US6393447B1 (en) Method and apparatus for extracting unbiased random bits from a potentially biased source of randomness
CA2225899A1 (en) A method and apparatus for finite field multiplication
US3984668A (en) Method for generating pseudo-random bit sequence words and a device for carrying out the method
US4691291A (en) Random sequence generators
JP2009003925A (en) Extension of repetition period of random sequence
JPS6197746A (en) Random number generator
US3614400A (en) Maximum length pulse sequence generators
EP2002330B1 (en) Method and apparatus for generating random numbers
Harase On the F2-linear relations of Mersenne Twister pseudorandom number generators
Eddy Random number generators for parallel processors
RU2598781C1 (en) Method of linear conversion (versions)
US8909510B2 (en) LFSR emulation
JPS6146524A (en) Pseudo random number generating device
JPS6146523A (en) Pseudo random number generating device
Beletsky Generalized Galois and Fibonacci Matrices in Cryptographic Applications
RU2246129C2 (en) Random numbers generation method
JP2000298577A (en) Random number generation device
Bonačić et al. Pseudo-random digital transformation
JPS5843743B2 (en) Encryption method
JPH0869372A (en) Binary multiplier
Hill Cyclic properties of pseudo-random sequences of Mersenne prime residues