lundi 20 mars 2017

Predicting the outcome of PHP rand() function given a seeded value

Recently I've been getting into the whole idea of LCGs and Pseudorandom number generators. Anyway, I though that PHP should be a good starting point.

My question is, given a seeded number (done through srand() ) how does one predict the next number in the rand() sequence?

From what I understand the function should be something like (SEED * A + C) mod M How can I find the values of A, C, and M? And if I find those values, can I predict the next number in the sequence?




Aucun commentaire:

Enregistrer un commentaire