1

What is the best way to detect repeating sequences of random numbers?

For example, say I got two random number generators (RNG). One of them has been tampered with and is repeating the sequence of random numbers after every N iterations. The other RNG has not been tampered with and is producing random numbers like it should.

However, one of them is repeating its output every N bytes. N can be small or very large. How to detect this in a reliable and economic way?

Is using rolling hashes (like rsync does) a viable approach?

Bollit
  • 13
  • 3

1 Answers1

1

does not yet seem to be a duplicate on this very site:
cycle detection, see also where hares catch up with turtles
(would-be comment: the question first states repetition every N iterations, next every N bytes.)
(If it didn't carry over: for each PRNG to check, have a clone. For each change in state of the original one, trigger two in the clone. If the states get identical, you detected a cycle. No deterministic PRNG with limited state can avoid it. The states need not be as small as the results; they rarely are, nowadays, and the cycle lengths are huge.)

greybeard
  • 1,041
  • 2
  • 9
  • 23