Last active
August 29, 2015 14:04
-
-
Save shotarok/4fb46422ddd1b3f95b94 to your computer and use it in GitHub Desktop.
Arith.gcc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LDC 8 ; now | |
LDC 3 ; A | |
LDC 5 ; B | |
LDC 13 ; M | |
LDF LCGs | |
AP 4 | |
LDC 3 ; A | |
LDC 5 ; B | |
LDC 13 ; M | |
LDF LCGs | |
AP 4 | |
LDC 3 ; A | |
LDC 5 ; B | |
LDC 13 ; M | |
LDF LCGs | |
AP 4 | |
RTN | |
LCGs: | |
LD 0 0 ; load now from env | |
LD 0 1 ; load A from env | |
MUL | |
LD 0 2 ; load B from env | |
ADD | |
LD 0 3 ; load M from env | |
LDF mod | |
AP 2 | |
RTN | |
mod: | |
LD 0 0 ; mod fucntion | |
LD 0 0 | |
LD 0 1 | |
DIV | |
LD 0 1 | |
MUL | |
SUB | |
RTN | |
; 線形合同法 Linear congruential generators(LCGs) | |
;; next = LCGs(now, A, B, M){ return (A * now + B) mod M; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LDC 10 ; a | |
LDC 3 ; b | |
LDF 6 ; load mod | |
AP 2 ; call mod(a, b) | |
DBUG | |
RTN | |
LD 0 0 ; mod fucntion | |
LD 0 0 | |
LD 0 1 | |
DIV | |
LD 0 1 | |
MUL | |
SUB | |
RTN |
deref.cpp は現在のバージョンだと、先頭にコメントをつけると行数がずれる
よい seed, A, B, M の選び方
http://www7b.biglobe.ne.jp/~robe/cpphtml/html03/cpp03031.html
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
mod の ラベル付きバーションはこちら
これを レポジトリにある deref.cpp を使えばコンパイルできる