changeset 8343:0862dff6dfba

(Frandom): Use just the low 30 bits of random's value.
author Richard M. Stallman <rms@gnu.org>
date Tue, 26 Jul 1994 19:25:42 +0000
parents 95c011057e51
children e206050c7d51
files src/fns.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/fns.c	Tue Jul 26 19:18:06 1994 +0000
+++ b/src/fns.c	Tue Jul 26 19:25:42 1994 +0000
@@ -71,9 +71,9 @@
 	 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