JPS58114134A - Random number generator - Google Patents

Random number generator

Info

Publication number
JPS58114134A
JPS58114134A JP56209631A JP20963181A JPS58114134A JP S58114134 A JPS58114134 A JP S58114134A JP 56209631 A JP56209631 A JP 56209631A JP 20963181 A JP20963181 A JP 20963181A JP S58114134 A JPS58114134 A JP S58114134A
Authority
JP
Japan
Prior art keywords
random number
counter
initial value
processing
counted
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
JP56209631A
Other languages
Japanese (ja)
Inventor
Hisanobu Kosugi
小杉 壽伸
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.)
Hitachi High Tech Corp
Original Assignee
Hitachi Electronics Engineering 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 Hitachi Electronics Engineering Co Ltd filed Critical Hitachi Electronics Engineering Co Ltd
Priority to JP56209631A priority Critical patent/JPS58114134A/en
Publication of JPS58114134A publication Critical patent/JPS58114134A/en
Pending 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/586Pseudo-random number generators using an integer algorithm, e.g. using linear congruential method

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computational Mathematics (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Pure & Applied Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Debugging And Monitoring (AREA)

Abstract

PURPOSE:To set automatically an initial value to generate easily high-quality random numbers, by providing a random number generation processing program in a calculator and setting the counted vlaue of a counter as the initial value of the random number generation processing when an initial value setting request is issued at the program operation time. CONSTITUTION:The clock output from a clock oscillator 1 is applied to a counter 2 as a program counter and a counter 3 as a watchdog timer and is counted successively in accordance with respective purposes. Clocks from the oscillator 1 are applied to a counter 4 for the random number processing, and the counted value is taken into this counter 4 by the designation of a random number processing routine F. This routine F is a kind of processing routine in the calculator and is accessed when the random number processing is requested. The counter 4 is used as an interval timer, and the counted value of the counter 4 is set as the initial value when the initial value setting is requested at the program operation time, and the random number generation processing is processed by the successive calculation method due to the mixed congruence method.

Description

【発明の詳細な説明】 本発明は乱数発生器に関する◎ 大量のランダムデータを得るには、計算機本マイクロコ
ンピュータ)t−利用すればよい。゛計算機による大量
のランダムデータの発生は、数式によって逐次計算する
のが最も効率的であるが、数式によった場合は与える′
初期値によって全体の乱数が一意的に足まってしまう欠
点を持つ、即ち、計算機の演算において乱数を逐次計算
する場合、その初期値そのものを指定していタタめ、計
算式の性質をよく知っていなければ使用する事ができな
かった。例えば、同じ初期値を与えた時、乱数発生処理
ルーチンのパスが常に同じであるので、得られる乱数列
は必ず同一のものになってしまい、これはもはや乱数と
はいえない。−万、計算機処理の性質上機能付加は、や
むを得ないものとの前提に立ち、計算機に乱数発生器(
ソフト)ヲ設けるやり方がある。この方法では、その計
算式や計算のアルゴリズムを意識しなくてもよいように
できることが望ましい。しかし、現在までその効果的な
方法はみつかっていない。
DETAILED DESCRIPTION OF THE INVENTION The present invention relates to a random number generator. To obtain a large amount of random data, a computer (microcomputer) may be used. ``When generating a large amount of random data by a computer, it is most efficient to calculate it sequentially using a mathematical formula, but when using a mathematical formula, it is
There is a drawback that the entire random number is uniquely summed up by the initial value. In other words, when calculating random numbers sequentially in a computer operation, the initial value itself is specified, and it is difficult to understand the properties of the calculation formula well. I couldn't use it without it. For example, when the same initial value is given, the path of the random number generation processing routine is always the same, so the resulting random number sequence is always the same and can no longer be called random numbers. - 10,000, based on the premise that addition of functions is unavoidable due to the nature of computer processing, we installed a random number generator (
There is a way to set up software. With this method, it is desirable to be able to do so without having to be aware of the calculation formula or calculation algorithm. However, no effective method has been found to date.

本発明の目的は、計算式の性質を特別に知らなくても良
質の乱数を発生可能にした乱数発生器を23、提供する
ものである。
An object of the present invention is to provide a random number generator 23 that can generate high-quality random numbers without special knowledge of the properties of calculation formulas.

本発明の要旨は、計算機内のクロック発振器の出力を計
数するカウンタを設け、該カウンタの計数値を計−算機
内での乱数処理ルーチンの乱数発生用の1jiA値とし
て設定せしめた点にある。以下、本発明を詳述する。
The gist of the present invention is that a counter is provided for counting the output of a clock oscillator within the computer, and the counted value of the counter is set as the 1jiA value for random number generation in the random number processing routine within the computer. The present invention will be explained in detail below.

第1図は本発明の実施例である。クロック発振器lは、
インターバルタイマ設定用のクロック発振器であり、そ
のクロック出方は各種の計数値として利用される。カウ
ンタ2,3はその利用の一例をそれぞれ示すカウンタで
あり、カウンタ2はプログラムカウント用のカウンタ、
カウンタ3[ウオッチドックタイマ用の力、ウンタであ
る。カウンタ2.3のリセットはそのカウンタの使用目
的に応じてなされる。例えば、ウォッチドッグタイマ用
に使用するカウンタ3のセット、リセットは以下の通り
となる。異常利足用の基準計数値とカウンタ3の計数値
とが比較され、基準計数値内に相手(例えばIlo )
からの応答があれば相手からの応答は正常としてカウン
タ3はリセットされ、次の処理のために新たにセットさ
れクロック計数を開始する。基準値を越えても応答がな
ければ、その相手は異常があったものとして異常処理ル
ーチンニ入ル。一方、カウンタ計数用として使用スるカ
ウンタ2はプログラム読出しのタイミングに応じてクロ
ック(該クロックを分周して得たクロックの事例を含む
。このことはカウンタ3についても同じ)を計数する。
FIG. 1 shows an embodiment of the invention. The clock oscillator l is
This is a clock oscillator for setting an interval timer, and its clock output is used as various count values. Counters 2 and 3 are counters each showing an example of its use, and counter 2 is a counter for program counting;
Counter 3 [Power for watchdog timer, counter. The counter 2.3 is reset depending on the purpose of use of the counter. For example, the setting and resetting of the counter 3 used for the watchdog timer is as follows. The standard count value for abnormal utilization and the count value of counter 3 are compared, and if the opponent (for example, Ilo) is within the standard count value,
If there is a response from the other party, it is assumed that the response from the other party is normal and the counter 3 is reset, and is newly set for the next process and starts clock counting. If there is no response even after the reference value is exceeded, the other party assumes that an error has occurred and enters the error handling routine. On the other hand, the counter 2 used for counter counting counts a clock (including an example of a clock obtained by frequency-dividing the clock; the same applies to the counter 3) according to the timing of program reading.

この計数値がプログラム番号に該当する。該カウンタ3
は逐次的に計数を行ってゆ(が、プログラム上一時退避
等の必要性が生じた時には、レジスタやメモリヘラッチ
される。
This count value corresponds to the program number. The counter 3
is counted sequentially (However, when the need for temporary saving arises in the program, it is latched to a register or memory.

カウンタ4は、乱数処理用に設けられている。The counter 4 is provided for random number processing.

カウンタ4の計数対象はクロック発振器1のクロックで
あり、ビット容量は16ビツトである。従って、2′6
個までのクロックを計数できる。このカウンタ4の計数
値の取込又は、乱数処理ルーチンFの指令によって行わ
れる。乱数処理ルーチンF。
The counter 4 counts the clock of the clock oscillator 1, and has a bit capacity of 16 bits. Therefore, 2'6
It is possible to count up to 1 clock. This is performed by taking in the counted value of the counter 4 or by commanding the random number processing routine F. Random number processing routine F.

は、計X機内の処理ルーチンの一種であり、例えば、サ
ブルーチンである。この乱数処理ルーチンFは乱数処理
要求時にアクセスされ、その処理内容は、初期値の設定
処理、この設定された初期的に基づ(乱数計算処理、該
計算された乱数の出力処理(内部出力、外部出力のいず
れでも可)より成る。乱数計算処理は逐次計算法による
計算処理である。この逐次計算法では、初期値が必要と
なる。この初期値の設定処理では、カウンタ4をアクセ
スし、その時点での計数値を取込入初期値として設定せ
しめている。このカウンタ4でのクロックと初期値設定
要求、換言すれば、クロックと乱数要求動機とは非同期
である。従って、乱数を要求する時点の計数値はランダ
ムであり、これを逐次計算用の初期値と設定することに
よって、良質な乱数列を得ることができた。
is a type of processing routine within the machine, for example, a subroutine. This random number processing routine F is accessed when a random number processing request is made, and its processing contents include initial value setting processing, random number calculation processing based on the set initial value, output processing of the calculated random number (internal output, The random number calculation process is a calculation process using a sequential calculation method. This sequential calculation method requires an initial value. In this initial value setting process, the counter 4 is accessed, The count value at that time is set as the input initial value.The clock and the initial value setting request in this counter 4, in other words, the clock and the random number request motive are asynchronous.Therefore, the random number request is made. The count value at the time of calculation is random, and by setting this as the initial value for sequential calculation, a high-quality random number sequence can be obtained.

第2図は乱数処理ルーチンの処理内容を示す。FIG. 2 shows the processing contents of the random number processing routine.

この処理は、逐次乱数計算であり、混合合同法のアルゴ
リズムによって構成されるグログラムである。乱数処理
であれば、初期値設定処理フローに処理が移り、カウン
タ4のその時点での計数値を乱数初期値用レジスタ(図
示せず)に取込む。次に、この初期値をもとに逐次計算
法による乱数計算を行う。計算結果は、逐次に出力(内
部出力、外部出力いずれも可〕しシステムに応じた利用
がなされる。乱数利用には、プログラムのデパック、デ
スクメモリへのランダムデータの書込み、それに基づく
正しく書込めたか否かのチェック等がある。更に、外部
利用には、共有パス方式下でのパス占有処理用のデータ
として共有パスに送出する場合がある。次いで、初期値
再設定か否かの処理が行われ、再設定要求であれば、再
びカウンタ4のその時点での計数値の取込入処理を行う
。再設定でなければ、そのまま逐次計算法による乱数計
算が実行されてゆく。
This process is sequential random number calculation, and is a glogram constructed by a mixed congruence algorithm. If it is random number processing, the process moves to the initial value setting processing flow, and the current count value of the counter 4 is taken into a random number initial value register (not shown). Next, random number calculation is performed using the sequential calculation method based on this initial value. The calculation results are output sequentially (either internal or external output is possible) and used according to the system.Using random numbers involves depacking the program, writing random data to desk memory, and writing correctly based on it. Furthermore, for external use, data may be sent to the shared path as data for path occupancy processing under the shared path method.Next, processing is performed to determine whether or not to reset the initial value. If a resetting request is made, the count value of the counter 4 at that time is read in again.If it is not a resetting request, random number calculation by the sequential calculation method is continued.

カウンタ4は計算機内に内蔵されているタイマを利用す
ることが望ましい。例えば、日立シングルボードコンピ
ュータ(H68/5BO2)に内蔵された10m5ec
インターバルタイマを使用する。この際初期値設定要求
が10m5ecの1インターバル内に2回以上生ずる事
は極めて稀であって、乱数の品質低下をまねくことはな
いが、もし1QH1aec以内に初期値設定要求が2回
以上生じた場合はインターバルタイマのインターバルf
 1 m5ecとなるなどによって解決解決できる。こ
れらのことは、他のマイクロコンピュータでも同様であ
る。
It is preferable that the counter 4 uses a timer built into the computer. For example, the 10m5ec built in Hitachi single board computer (H68/5BO2)
Use interval timer. At this time, it is extremely rare for an initial value setting request to occur more than once within one interval of 10m5ec, and this will not cause a deterioration in the quality of the random numbers, but if an initial value setting request occurs more than once within 1QH1aec. If the interval f of the interval timer
This can be solved by becoming 1 m5ec. These things also apply to other microcomputers.

本発明によれば、初期値が自動的に設定でき、使いやす
く、乱数の逐次計算アルゴリズムが有する乱数の一様性
を保証できた。
According to the present invention, the initial value can be automatically set, it is easy to use, and the uniformity of random numbers that is provided by the random number sequential calculation algorithm can be guaranteed.

尚、1初期値の設定は、混合合同法による逐次計算法の
場合が好適であるが、他の方法でも初期値設定が必要で
ある時には本発明は適用できる。
Although it is preferable to set one initial value using a sequential calculation method using a mixed congruence method, the present invention can be applied when initial value setting is required using other methods as well.

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

第1図は本発明の乱数発生器の実施例図、第2図は乱数
処理ルーチンの゛フローチャート図である。 1・・・クロック発振器、4・・・カウンタ、F・・・
乱数処理ルーチン。 特許出願人   日立電子エンジニアリング株式会社代
理人弁理士  秋  本  正  実第1図
FIG. 1 is an embodiment of the random number generator of the present invention, and FIG. 2 is a flowchart of the random number processing routine. 1... Clock oscillator, 4... Counter, F...
Random number processing routine. Patent Applicant Hitachi Electronics Engineering Co., Ltd. Representative Patent Attorney Tadashi Akimoto Figure 1

Claims (1)

【特許請求の範囲】 1、 クロック発振器及び該クロック発振器の発振クロ
ックの計数を行5カウンタを内部に備えてなる計算機よ
り成ると共に、該計1[機内に乱数発生処理プログラム
を持たせ、該プログラム作動時の初期値設定要、求時に
上記カウンタのその時点での計数値を乱数発生処理の初
期値として設定せしめてなる乱数発生器。 2、上記乱数発生処理は混合合同法による逐次計算方法
による処理である特許請求の範囲第1項記載の乱数発生
器。 3、上記カウンタヒインターパルタイマより成る特許請
求の範囲第1項、第2項記載の乱数発生器O
[Scope of Claims] 1. Consists of a clock oscillator and a computer internally equipped with a 5-row counter for counting the oscillation clock of the clock oscillator; A random number generator configured to set the current count value of the counter as an initial value for random number generation processing when an initial value setting request is made during operation. 2. The random number generator according to claim 1, wherein the random number generation process is performed by a sequential calculation method using a mixed congruential method. 3. Random number generator O according to claims 1 and 2, comprising the above-mentioned counterhyinterpulse timer.
JP56209631A 1981-12-28 1981-12-28 Random number generator Pending JPS58114134A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP56209631A JPS58114134A (en) 1981-12-28 1981-12-28 Random number generator

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP56209631A JPS58114134A (en) 1981-12-28 1981-12-28 Random number generator

Publications (1)

Publication Number Publication Date
JPS58114134A true JPS58114134A (en) 1983-07-07

Family

ID=16575991

Family Applications (1)

Application Number Title Priority Date Filing Date
JP56209631A Pending JPS58114134A (en) 1981-12-28 1981-12-28 Random number generator

Country Status (1)

Country Link
JP (1) JPS58114134A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH01189726A (en) * 1988-01-26 1989-07-28 Matsushita Electric Works Ltd Random number generator
JPH08123669A (en) * 1994-10-20 1996-05-17 Aizatsuku:Kk Random number generating circuit
JPH10507561A (en) * 1996-03-07 1998-07-21 セー・ペー・8・トランザツク Improved integrated circuit and method of using the integrated circuit
KR100563885B1 (en) * 2001-03-07 2006-03-28 가부시끼가이샤 도시바 Random number's seed generating circuit, driver including the same, and memory card system
CN104426651A (en) * 2013-08-30 2015-03-18 上海复旦微电子集团股份有限公司 Data processing method and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS5469345A (en) * 1977-11-14 1979-06-04 Casio Comput Co Ltd Random number generation system
JPS5492144A (en) * 1977-12-29 1979-07-21 Fujitsu Ltd Generator for random number
JPS5637132B2 (en) * 1978-05-10 1981-08-28

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS5469345A (en) * 1977-11-14 1979-06-04 Casio Comput Co Ltd Random number generation system
JPS5492144A (en) * 1977-12-29 1979-07-21 Fujitsu Ltd Generator for random number
JPS5637132B2 (en) * 1978-05-10 1981-08-28

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH01189726A (en) * 1988-01-26 1989-07-28 Matsushita Electric Works Ltd Random number generator
JPH08123669A (en) * 1994-10-20 1996-05-17 Aizatsuku:Kk Random number generating circuit
JPH10507561A (en) * 1996-03-07 1998-07-21 セー・ペー・8・トランザツク Improved integrated circuit and method of using the integrated circuit
KR100563885B1 (en) * 2001-03-07 2006-03-28 가부시끼가이샤 도시바 Random number's seed generating circuit, driver including the same, and memory card system
CN104426651A (en) * 2013-08-30 2015-03-18 上海复旦微电子集团股份有限公司 Data processing method and device

Similar Documents

Publication Publication Date Title
Downham et al. Multiplicative congruential pseudo-random number generators
US3855459A (en) Apparatus for converting data into the same units
JPS58114134A (en) Random number generator
JPS57172444A (en) Approximate quotient correcting circuit
CN111177267A (en) Data transmission method and device, electronic equipment and storage medium
JPS5291626A (en) Input data correction system in electronic apparatus
Anvekar et al. Transducer output signal processing using dual and triple microprocessor systems
JPS5840769B2 (en) random number generator
JPS633336A (en) System production system
JPS6148740B2 (en)
JP3025318U (en) Reset signal generator
JPS59129994A (en) Check system of control program of computer
JPS5525112A (en) Self-diagnostic system
SU1509883A1 (en) Random number generator with arbitrary distribution law
JPS55901A (en) Data buffer control system
JPS5932929B2 (en) Pulse counting method
JPS6310465B2 (en)
JPS599930B2 (en) Status setting key determination device
Podlaska-Lando et al. Implementation and evaluation of internal arithmetic software. Report 2: The Honeywell MULTICS system
JPS6250860B2 (en)
JPS5469344A (en) Operation system
JPH02266438A (en) Checking circuit for vector arithmetic unit
JPS60181861A (en) Data setting system
JPS5572266A (en) Instruction counter
JPH01161558A (en) Data reading-out method of digital processor