Suppose you find the address(es) that govern the RNG, and know how to advance the RNG one RN at a time, indefinitely. This would effectively allow you to have a sample size of consecutive RNs as large as you want. Further assume that later RNs are generated entirely from previous RNs (say R_n+3 = (R_n+2 + R_n+1 + R_n)/3 or something similar) and not dictated by something more complex such as the character's position on the screen.
Is there a way to reverse engineer a huge data sample to find the actual formula that generates the RNs?
As a specific example, the random number generator for Fire Emblems 6 to 8 is as follows:
function nextrng(r1, r2, r3)
return AND(XOR(SHIFT(r3, 5), SHIFT(r2, -11), SHIFT(r1, -1), SHIFT(r2, 15)),0xFFFF)
end
It took me a while to even understand what the formula meant, but I basically convert the 3 RNs to a binary value, perform the binary operations (shift, xor, and), and convert the number back to decimal format to yield the correct result.
Is there a way a formula like that could be determined from a sample set of say, 100,000 consecutive RNs? Is there some kind of pattern recognition program you could run? Do you have to disassemble the ROM?