Given a series of numbers generated by rand(), how can I predict the next value? Brute force is out of the question. I'm aware that rand() is basically a linear congruential generator, but also makes bit shifting. What theory can I use to crack it? Any hints will be most welcome :)
Yes, it is possible to predict what number a random number generator will produce next. I've seen this called cracking, breaking, or attacking the RNG. Searching for any of those terms along with "random number generator" should turn up a lot of results.
The RAND function in stand-alone applications generates the same numbers each time you run your application because the uniform random number generator that RAND uses is initialized to same state when the application is loaded.
Pseudorandom numbers are generated by computers. They are not truly random, because when a computer is functioning correctly, nothing it does is random. Computers are deterministic devices — a computer's behavior is entirely predictable, by design.
@unwind: thanks for the advice! I was wrong in some places, and the documentation got me on the right track.
Actually, predicting is a piece of cake when you know a sequence of 30 (or so) numbers. The 'computed' answer will be right in 50% of cases. More details present in the link provided by unwind, or in a simplified code: http://www.mathstat.dal.ca/~selinger/random/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With