comparison src/fns.c @ 2039:fd0cbe945410

[xemacs-hg @ 2004-04-22 03:24:00 by james] Change VALBITS to INT_VALBITS in a number of places.
author james
date Thu, 22 Apr 2004 03:24:02 +0000
parents 9c872f33ecbe
children 61855263cb07
comparison
equal deleted inserted replaced
2038:c6190a5b1ece 2039:fd0cbe945410
168 are less random than the higher ones. We do this by using the 168 are less random than the higher ones. We do this by using the
169 quotient rather than the remainder. At the high end of the RNG 169 quotient rather than the remainder. At the high end of the RNG
170 it's possible to get a quotient larger than limit; discarding 170 it's possible to get a quotient larger than limit; discarding
171 these values eliminates the bias that would otherwise appear 171 these values eliminates the bias that would otherwise appear
172 when using a large limit. */ 172 when using a large limit. */
173 denominator = ((unsigned long)1 << VALBITS) / XINT (limit); 173 denominator = ((unsigned long)1 << INT_VALBITS) / XINT (limit);
174 do 174 do
175 val = get_random () / denominator; 175 val = get_random () / denominator;
176 while (val >= XINT (limit)); 176 while (val >= XINT (limit));
177 } 177 }
178 #ifdef HAVE_BIGNUM 178 #ifdef HAVE_BIGNUM