comparison src/fns.c @ 8367:31ceccb9982d

(Frandom): Fix previous change.
author Richard M. Stallman <rms@gnu.org>
date Thu, 28 Jul 1994 12:46:16 +0000
parents 0862dff6dfba
children e0c0247dca19
comparison
equal deleted inserted replaced
8366:3be9c6b57956 8367:31ceccb9982d
69 are less random than the higher ones. We do this by using the 69 are less random than the higher ones. We do this by using the
70 quotient rather than the remainder. At the high end of the RNG 70 quotient rather than the remainder. At the high end of the RNG
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)0xc0000000 / XFASTINT (limit); 74 denominator = (unsigned long)0x40000000 / XFASTINT (limit);
75 do 75 do
76 val = (random () & 0x3fffffff) / denominator; 76 val = (random () & 0x3fffffff) / denominator;
77 while (val >= limit); 77 while (val >= limit);
78 } 78 }
79 else 79 else