summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authormsofer <msofer@noemail.net>2001-05-07 22:15:29 (GMT)
committermsofer <msofer@noemail.net>2001-05-07 22:15:29 (GMT)
commitbb1cd0944cb14337b51ffdfe55b03afec3d36098 (patch)
treeca17d3333e1dbe2e2e189da350fd409b5ad2c2f7 /generic
parent1221c147241c8b4a7a3a3179100ab8c8d4856b45 (diff)
downloadtcl-bb1cd0944cb14337b51ffdfe55b03afec3d36098.zip
tcl-bb1cd0944cb14337b51ffdfe55b03afec3d36098.tar.gz
tcl-bb1cd0944cb14337b51ffdfe55b03afec3d36098.tar.bz2
rand() gets != seeds in != threads [Bug 416643]
FossilOrigin-Name: 679d116ef39e6e5c418da92ecf28583df16d4c80
Diffstat (limited to 'generic')
-rw-r--r--generic/tclExecute.c10
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.