Author: turner
Date: Wed Aug 30 02:27:48 2006
New Revision: 23791
URL:
http://svn.reactos.org/svn/reactos?rev=23791&view=rev
Log:
Better rand() implementation. This should fix the problem where you get 0 every time you
use rand()
Modified:
trunk/reactos/lib/crt/misc/tls.c
trunk/reactos/lib/crt/stdlib/rand.c
Modified: trunk/reactos/lib/crt/misc/tls.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/crt/misc/tls.c?rev=237…
==============================================================================
--- trunk/reactos/lib/crt/misc/tls.c (original)
+++ trunk/reactos/lib/crt/misc/tls.c Wed Aug 30 02:27:48 2006
@@ -13,6 +13,8 @@
ThreadData->tdoserrno = 0;
ThreadData->fpecode = 0;
+
+ ThreadData->tnext = 1;
/* FIXME: init more thread local data */
Modified: trunk/reactos/lib/crt/stdlib/rand.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/crt/stdlib/rand.c?rev=…
==============================================================================
--- trunk/reactos/lib/crt/stdlib/rand.c (original)
+++ trunk/reactos/lib/crt/stdlib/rand.c Wed Aug 30 02:27:48 2006
@@ -11,7 +11,7 @@
{
PTHREADDATA ThreadData = GetThreadData();
- ThreadData->tnext = ThreadData->tnext * 0x5deece66dLL + 11;
+ ThreadData->tnext = ThreadData->tnext * 0x5deece66dLL + 2531011;
return (int)((ThreadData->tnext >> 16) & RAND_MAX);
}