Is it possible to predict the next number in a number generator?

With programming, it is never "random." Even a random generator uses an algorithm to predict a random number. But, knowing the generation method, is it possible, say, to predict the next 5 numbers that will be generated?

+4
source share
3 answers

Yes, you can predict which number the random number generator will generate. I saw that this is called cracking, hacking, or attacking the RNG. Searching for any of these terms together with a "random number generator" should lead to great results.

Read How We Learned to Cheat Online Poker: A Software Security Study for an Excellent First-Hand Account of How a Random Number Generator Can Be Attacked. To summarize, the authors found that RNG is used based on the erroneous shuffling algorithm used by the online poker site. They then found out the seeds of RNG, taking samples that were distributed. Once they had the algorithm and the seed, they knew exactly how the deck would be organized after later shuffling.

+5
source

Assuming a deterministic algorithm. Create two identical random number generators. Ask the first what the second will produce next - 5 times.

+3
source

The vast majority of "random number generators" are actually "pseudo random number generators", which means that, given the same starting point (seed), they will reproduce the same sequence. Theoretically, observing a sequence of numbers over a certain period of time (and knowing a specific algorithm), you can predict the next number, very similar to “crack” encryption.

The time / effort required for this will vary greatly depending on the particular algorithm, of course. RNGs that are “cryptographic” will be much harder to predict than your RNG with a variety of gardens. But for most random number applications, such predictability is not a problem.

0
source

Source: https://habr.com/ru/post/1488750/


All Articles