From 26d270ab4891cff6b75601c5f1c57c5e8529ef39 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Tue, 26 Jul 1994 19:25:42 +0000 Subject: [PATCH] (Frandom): Use just the low 30 bits of random's value. --- src/fns.c | 4 ++-- 1 file 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.") it's possible to get a quotient larger than limit; discarding these values eliminates the bias that would otherwise appear when using a large limit. */ - denominator = (unsigned long)0x80000000 / XFASTINT (limit); + denominator = (unsigned long)0xc0000000 / XFASTINT (limit); do - val = (random () & 0x7fffffff) / denominator; + val = (random () & 0x3fffffff) / denominator; while (val >= limit); } else -- 2.39.5