diff options
author | Miguel Sofer <miguel.sofer@gmail.com> | 2001-05-07 22:15:29 (GMT) |
---|---|---|
committer | Miguel Sofer <miguel.sofer@gmail.com> | 2001-05-07 22:15:29 (GMT) |
commit | 1fd84bd466e07b5c88b1f036312f10d05e028c4c (patch) | |
tree | ca17d3333e1dbe2e2e189da350fd409b5ad2c2f7 /generic | |
parent | 0582de1567897a26acf73bb3d9982b9d622f445e (diff) | |
download | tcl-1fd84bd466e07b5c88b1f036312f10d05e028c4c.zip tcl-1fd84bd466e07b5c88b1f036312f10d05e028c4c.tar.gz tcl-1fd84bd466e07b5c88b1f036312f10d05e028c4c.tar.bz2 |
rand() gets != seeds in != threads [Bug 416643]
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclExecute.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c index fcad4a5..1e9f1e6 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclExecute.c,v 1.21 2001/04/07 03:15:38 msofer Exp $ + * RCS: @(#) $Id: tclExecute.c,v 1.22 2001/05/07 22:15:29 msofer Exp $ */ #include "tclInt.h" @@ -4083,7 +4083,13 @@ ExprRandFunc(interp, eePtr, clientData) if (!(iPtr->flags & RAND_SEED_INITIALIZED)) { iPtr->flags |= RAND_SEED_INITIALIZED; - iPtr->randSeed = TclpGetClicks(); + + /* + * Take into consideration the thread this interp is running in order + * to insure different seeds in different threads (bug #416643) + */ + + iPtr->randSeed = TclpGetClicks() + ((long) Tcl_GetCurrentThread() << 12); /* * Make sure 1 <= randSeed <= (2^31) - 2. See below. |