Does msvcrt.dll use a linear congruential generator for its rand() function?
问题 I am trying to predict the output of a program that uses msvcrt's rand() function for generating the face of three dice. I believe the code is something like: dice[0] = rand() % 6 + 1; dice[1] = rand() % 6 + 1; dice[2] = rand() % 6 + 1; , and I was wondering if I could use a prediction program for linear congruential generators to predict the next numbers in the sequence. 回答1: See for yourself: C:\Program Files\Microsoft Visual Studio 8\VC\crt\src\rand.c (Or use %VCINSTALLDIR%\crt\src\rand.c