aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1994-07-26 19:25:42 +0000
committerRichard M. Stallman1994-07-26 19:25:42 +0000
commit26d270ab4891cff6b75601c5f1c57c5e8529ef39 (patch)
treeb2ad1cb302ece9265a1f75b5df13e7b4b9e49e2b /src
parentb4300a1a6ca1725bee18f0ce8f2636869341e16e (diff)
downloademacs-26d270ab4891cff6b75601c5f1c57c5e8529ef39.tar.gz
emacs-26d270ab4891cff6b75601c5f1c57c5e8529ef39.zip
(Frandom): Use just the low 30 bits of random's value.
Diffstat (limited to 'src')
-rw-r--r--src/fns.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/fns.c b/src/fns.c
index 35cd7e4bca5..59dd3b7eeea 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -71,9 +71,9 @@ With argument t, set the random number seed from the current time and pid.")
71 it's possible to get a quotient larger than limit; discarding 71 it's possible to get a quotient larger than limit; discarding
72 these values eliminates the bias that would otherwise appear 72 these values eliminates the bias that would otherwise appear
73 when using a large limit. */ 73 when using a large limit. */
74 denominator = (unsigned long)0x80000000 / XFASTINT (limit); 74 denominator = (unsigned long)0xc0000000 / XFASTINT (limit);
75 do 75 do
76 val = (random () & 0x7fffffff) / denominator; 76 val = (random () & 0x3fffffff) / denominator;
77 while (val >= limit); 77 while (val >= limit);
78 } 78 }
79 else 79 else