Take the 2-minute tour ×
Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. It's 100% free, no registration required.

How can I accurately predict the next random number between 1 and 999, given past results. I have no knowledge of the PRNG or algorithm used.

How can I predict the next number of a long sequence of seemingly random numbers? Can I do it by hand, or should I use some kind of software to help find patterns from long strings of data?

share|improve this question

closed as too broad by fgrieu, CodesInChaos, DrLecter, tylo, AFS Jan 21 at 19:11

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.If this question can be reworded to fit the rules in the help center, please edit the question.

    
if it uses a proper CSPRNG, you may need billions of samples to find a pattern. knowing if you can even find one would help –  Richie Frame Jan 21 at 10:25
    
whats the cs mean? sorry im fairly new to this, lets just say its your run of the mill PRNG. –  C.B. Dooper Jan 21 at 10:30
    
Cryptographically Secure, most of the time implemented with a secure hash of an entropy pool that gets mixed in again for the next round –  ratchet freak Jan 21 at 11:30
    
You said "I have no knowledge of the prng or algorithm used". This means, that you are potentially facing a very weak or very strong algorithm. However, finding out what algorithm is used is out of scope of cryptography. IF(!) it is a weak algorithm (e.g. a LCG), you might be lucky with statistical analysis. If it is a strong one, there is basically no way you can find out which one (except trying out every possible algorithm with every possible starting parameter and run it for the entire period). –  tylo Jan 21 at 14:05
    
More than that - you are potentially facing true random data... –  figlesquidge Jan 21 at 16:09

1 Answer 1

This sounds like a lot of work.

I would break this down into parts. First, I would try to identify the random number generator being used. From that, my goal would be to determine the starting seed, which would let me accurately predict future results based on past results.

I'd start with the NIST Random Number Generation statistical tests In them, they offer 15 statistical tests for a random number generator. I'd run the sample data through this battery of tests to see if it's actually random or not. Important: if the tests reveal it is random, that could be evidence that a cryptographically secure random number generator was used to produce them. I would stop searching as I would consider the problem unsolvable at that point.

I'd then test each of the random number generators that the original source might have used, such as rand(), and see if they reveal a pattern similar to that output of the mystery algorithm.

Once a potential random number generator is identified, I'd turn to published papers to see what kinds of analysis and reversals are known for it.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.