Commit 53099a27 authored by rswindell's avatar rswindell
Browse files

Deuce's mod to sbbs_srand() to use /dev/random to seed the random number

generator (when available).
parent 34374fab
......@@ -265,7 +265,18 @@ static BOOL winsock_startup(void)
DLLEXPORT void DLLCALL sbbs_srand()
{
srand(time(NULL) ^ (DWORD)GetCurrentThreadId());
DWORD seed = time(NULL) ^ (DWORD)GetCurrentThreadId();
#if defined(HAS_DEV_RANDOM) && defined(RANDOM_DEV)
int rf;
if((rf=open(RANDOM_DEV, O_RDONLY))!=-1) {
read(rf, &seed, sizeof(seed));
close(rf);
}
#endif
srand(seed);
sbbs_random(10); /* Throw away first number */
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment