Обратимые ГПСЧ |
[Oct. 26th, 2010|09:01 pm] |
Mental Driller использовал xor-перестановки, есть еще один вариант LCG+ICG
How one could achieve a "random" behaviour of index variable in a polymorphic decription loop? This topic was already mentioned on this forum, here (MentalDriller's PRIDE, xor-based permutation). Another idea is to use a LCG and find the modular mulptiplicative inverse for the selected multiplier. I wont go into math details of the topic (you can easily find all neccessary info in Wiki), so suppose that we have LCG: x_next = (a * x + c) mod m; if we choose prime m, it's immediately follows from the properties of LCG, that there exists such r, that (a * r) mod m = 1, and that x_prev = (r * (x - c)) mod m. In other words it is the random numbers generator which could produce the same sequence in a reverse order. |
|
|