This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: drand48() (and erand48) returns only zeros and pthread application problems - in cygwin 1.7.8 returns always same values

On Tue, Jan 11, 2011 at 11:50:14AM +0100, jdzstz - gmail dot com wrote:
>About all the problems with drand48, explained in:
>   *
>Christopher Faylor fixed it in 20101229 snapshot:
>I have realized that the fix does not work as expected, it is used
>thread memory address to initialize srand48 with srand48 ((long int)
>--- winsup-src-20101226/cygwin-snapshot-20101226-1/winsup/cygwin/	2010-02-28
>15:55:33.000000000 +0000
>+++ winsup-src-20101229/cygwin-snapshot-20101229-1/winsup/cygwin/	2010-12-29
>06:34:24.000000000 +0000
>@@ -94,4 +95,5 @@ _cygtls::init_thread (void *x, DWORD (*f
>       local_clib._current_locale = "C";
>       locals.process_logmask = LOG_UPTO (LOG_DEBUG);
>+      srand48 ((long int) &x);
>     }
>Now, drand48 doesnot returns zero in thread, but the problem is that
>in every execution the adress should be the same, because it returns
>always the same values.

Right.  That was exactly the point.  If you want more randomness then
seed this yourself.  Linux always provides a fixed series of numbers when
srand48 has not been called too.


Problem reports:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]