#include <EVERYTHING>
constunsignedint MAX = 10000;
int main()
{
srand(time(NULL));
int Numbers[MAX];
int Unknown;
for(unsignedint i = 0; i < MAX; i++)
{
Numbers[i] = rand()%255;
}
Unknown = rand()%255;
}
By knowing a given set of values of Numbers, is it possible to either calculate the seed of the random function (find the time that the program ran), or calculate what Unknown will be without brute forcing every possible seed? Suppose I know/wrote the specific algorithm that this implementation of rand() uses.
If anyone has any insight to this problem, or knows any literature either in print or on the web that I could consult, that would be lovely.
Well, the answer depends on the algorithm used to generate the pseudo-random numbers. But if I understand correctly, most implementations of rand() use a linear congruential generator [1].
In that case, you're lucky. As someone has written a paper about this!