aboutsummaryrefslogtreecommitdiffstats
path: root/src/fns.c
diff options
context:
space:
mode:
authorJoakim Verona2011-07-15 04:39:29 +0200
committerJoakim Verona2011-07-15 04:39:29 +0200
commit4f616a2e7ed1db28da98df90266e9751a8ae9ee1 (patch)
tree74a9dcbe13e945e712ae04a4a94c2202ca720591 /src/fns.c
parentff2be00005c3aeda6e11d7ed264ce86f02b60958 (diff)
parentec2bc542a4d0127425625e8cb458684bd825675a (diff)
downloademacs-4f616a2e7ed1db28da98df90266e9751a8ae9ee1.tar.gz
emacs-4f616a2e7ed1db28da98df90266e9751a8ae9ee1.zip
merge from upstream
Diffstat (limited to 'src/fns.c')
-rw-r--r--src/fns.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/fns.c b/src/fns.c
index b6fe2a7f7b6..0ca731ed331 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -79,10 +79,14 @@ Other values of LIMIT are ignored. */)
79{ 79{
80 EMACS_INT val; 80 EMACS_INT val;
81 Lisp_Object lispy_val; 81 Lisp_Object lispy_val;
82 EMACS_UINT denominator;
83 82
84 if (EQ (limit, Qt)) 83 if (EQ (limit, Qt))
85 seed_random (getpid () + time (NULL)); 84 {
85 EMACS_TIME t;
86 EMACS_GET_TIME (t);
87 seed_random (getpid () ^ EMACS_SECS (t) ^ EMACS_USECS (t));
88 }
89
86 if (NATNUMP (limit) && XFASTINT (limit) != 0) 90 if (NATNUMP (limit) && XFASTINT (limit) != 0)
87 { 91 {
88 /* Try to take our random number from the higher bits of VAL, 92 /* Try to take our random number from the higher bits of VAL,
@@ -92,7 +96,7 @@ Other values of LIMIT are ignored. */)
92 it's possible to get a quotient larger than n; discarding 96 it's possible to get a quotient larger than n; discarding
93 these values eliminates the bias that would otherwise appear 97 these values eliminates the bias that would otherwise appear
94 when using a large n. */ 98 when using a large n. */
95 denominator = ((EMACS_UINT) 1 << VALBITS) / XFASTINT (limit); 99 EMACS_INT denominator = (INTMASK + 1) / XFASTINT (limit);
96 do 100 do
97 val = get_random () / denominator; 101 val = get_random () / denominator;
98 while (val >= XFASTINT (limit)); 102 while (val >= XFASTINT (limit));
@@ -2613,6 +2617,7 @@ is not loaded; so load the file FILENAME.
2613If FILENAME is omitted, the printname of FEATURE is used as the file name, 2617If FILENAME is omitted, the printname of FEATURE is used as the file name,
2614and `load' will try to load this name appended with the suffix `.elc' or 2618and `load' will try to load this name appended with the suffix `.elc' or
2615`.el', in that order. The name without appended suffix will not be used. 2619`.el', in that order. The name without appended suffix will not be used.
2620See `get-load-suffixes' for the complete list of suffixes.
2616If the optional third argument NOERROR is non-nil, 2621If the optional third argument NOERROR is non-nil,
2617then return nil if the file is not found instead of signaling an error. 2622then return nil if the file is not found instead of signaling an error.
2618Normally the return value is FEATURE. 2623Normally the return value is FEATURE.