diff options
| author | Joakim Verona | 2011-07-15 04:39:29 +0200 |
|---|---|---|
| committer | Joakim Verona | 2011-07-15 04:39:29 +0200 |
| commit | 4f616a2e7ed1db28da98df90266e9751a8ae9ee1 (patch) | |
| tree | 74a9dcbe13e945e712ae04a4a94c2202ca720591 /src/fns.c | |
| parent | ff2be00005c3aeda6e11d7ed264ce86f02b60958 (diff) | |
| parent | ec2bc542a4d0127425625e8cb458684bd825675a (diff) | |
| download | emacs-4f616a2e7ed1db28da98df90266e9751a8ae9ee1.tar.gz emacs-4f616a2e7ed1db28da98df90266e9751a8ae9ee1.zip | |
merge from upstream
Diffstat (limited to 'src/fns.c')
| -rw-r--r-- | src/fns.c | 11 |
1 files changed, 8 insertions, 3 deletions
| @@ -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. | |||
| 2613 | If FILENAME is omitted, the printname of FEATURE is used as the file name, | 2617 | If FILENAME is omitted, the printname of FEATURE is used as the file name, |
| 2614 | and `load' will try to load this name appended with the suffix `.elc' or | 2618 | and `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. |
| 2620 | See `get-load-suffixes' for the complete list of suffixes. | ||
| 2616 | If the optional third argument NOERROR is non-nil, | 2621 | If the optional third argument NOERROR is non-nil, |
| 2617 | then return nil if the file is not found instead of signaling an error. | 2622 | then return nil if the file is not found instead of signaling an error. |
| 2618 | Normally the return value is FEATURE. | 2623 | Normally the return value is FEATURE. |