mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 08:55:19 +00:00
Better rand() implementation. This should fix the problem where you get 0 every time you use rand()
svn path=/trunk/; revision=23791
This commit is contained in:
parent
0a5a03e8d1
commit
7b27e1c573
2 changed files with 3 additions and 1 deletions
|
@ -14,6 +14,8 @@ static void InitThreadData(PTHREADDATA ThreadData)
|
|||
|
||||
ThreadData->fpecode = 0;
|
||||
|
||||
ThreadData->tnext = 1;
|
||||
|
||||
/* FIXME: init more thread local data */
|
||||
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ rand(void)
|
|||
{
|
||||
PTHREADDATA ThreadData = GetThreadData();
|
||||
|
||||
ThreadData->tnext = ThreadData->tnext * 0x5deece66dLL + 11;
|
||||
ThreadData->tnext = ThreadData->tnext * 0x5deece66dLL + 2531011;
|
||||
return (int)((ThreadData->tnext >> 16) & RAND_MAX);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue