Answer the question
In order to leave comments, you need to log in
Help identifying the PRNG algorithm
So far, I am inclined that this is one of the variants of the Fibonacci, but I would like more details.
Roughly speaking, it works like this.
There are two numbers
A and B
(actually A and is returned as random)
and for “shaking” it is used
(A + B) mod m
and then a shift to the left with a transfer
After which the resulting number is written in B, and what was in B before that is transferred in A
On ASM it looks something like this.
mov ax,seed1
push cx
push bx
mov bx,seed2
mov cx,ax
add cx,bx
rol cx,01h
mov seed1,bx
mov seed2,cx
pop bx
pop cx
ret
.data
seed1 DW 0005h
seed2 DW 0011h
Answer the question
In order to leave comments, you need to log in
The List of Algorithms is Knuth's second volume. There was something like that, but not to such an extent simplified.
The magic constants 0x0011 and 0x0005 do appear in the Fibonacci generator, but that's where the similarity ends. First, the Fibonacci scheme does not use shifts, only addition/subtraction. Secondly, there the constants 0x0011 and 0x0005 do not set the numbers themselves, but the indexes in the array of previous generated values. I think it's some kind of self-propelled gun.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question