]> code.delx.au - gnu-emacs/blobdiff - src/fns.c
Mention that `delete-region' doesn't alter the kill ring.
[gnu-emacs] / src / fns.c
index 5d2524d5cc23002e1c4eb9aad9a028b0b0cacd90..0ca731ed331a7882d2c566ed6882df3d4c9b552d 100644 (file)
--- a/src/fns.c
+++ b/src/fns.c
@@ -79,10 +79,14 @@ Other values of LIMIT are ignored.  */)
 {
   EMACS_INT val;
   Lisp_Object lispy_val;
-  EMACS_UINT denominator;
 
   if (EQ (limit, Qt))
-    seed_random (getpid () + time (NULL));
+    {
+      EMACS_TIME t;
+      EMACS_GET_TIME (t);
+      seed_random (getpid () ^ EMACS_SECS (t) ^ EMACS_USECS (t));
+    }
+
   if (NATNUMP (limit) && XFASTINT (limit) != 0)
     {
       /* Try to take our random number from the higher bits of VAL,
@@ -92,7 +96,7 @@ Other values of LIMIT are ignored.  */)
         it's possible to get a quotient larger than n; discarding
         these values eliminates the bias that would otherwise appear
         when using a large n.  */
-      denominator = ((EMACS_UINT) 1 << VALBITS) / XFASTINT (limit);
+      EMACS_INT denominator = (INTMASK + 1) / XFASTINT (limit);
       do
        val = get_random () / denominator;
       while (val >= XFASTINT (limit));