about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Src/Modules/mathfunc.c7
2 files changed, 12 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 41371caba..942c2be46 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-08-04  Peter Stephenson  <pws@csr.com>
+
+	* 22583: Peter A. Castro: Src/Modules/mathfunc.c: Cygwin erand48()
+	apparently needs initialisation.
+
 2006-08-03  Peter Stephenson  <pws@csr.com>
 
 	* 22581: Src/prompt.c, Src/utils.c, Src/Zle/complist.c,
diff --git a/Src/Modules/mathfunc.c b/Src/Modules/mathfunc.c
index 4d58745e8..f6d437ff9 100644
--- a/Src/Modules/mathfunc.c
+++ b/Src/Modules/mathfunc.c
@@ -534,6 +534,13 @@ math_string(UNUSED(char *name), char *arg, int id)
 		seedbufptr[0] = (unsigned short)rand();
 		seedbufptr[1] = (unsigned short)rand();
 		seedbufptr[2] = (unsigned short)rand();
+		/*
+		 * Some implementations of rand48() need initialization.
+		 * This is likely to be harmless elsewhere, since
+		 * according to the documentation erand48() normally
+		 * doesn't look at the seed set in this way.
+		 */
+		(void)seed48(seedbufptr);
 	    }
 	    ret.type = MN_FLOAT;
 	    ret.u.d = erand48(seedbufptr);