comparison src/fns.c @ 5935:d5eb0914ca1f cygwin

trial of E1 and UE1
author Henry Thompson <ht@markup.co.uk>
date Sat, 12 Dec 2015 21:49:31 +0000
parents e2fae7783046
children
comparison
equal deleted inserted replaced
5934:e2fae7783046 5935:d5eb0914ca1f
96 are less random than the higher ones. We do this by using the 96 are less random than the higher ones. We do this by using the
97 quotient rather than the remainder. At the high end of the RNG 97 quotient rather than the remainder. At the high end of the RNG
98 it's possible to get a quotient larger than limit; discarding 98 it's possible to get a quotient larger than limit; discarding
99 these values eliminates the bias that would otherwise appear 99 these values eliminates the bias that would otherwise appear
100 when using a large limit. */ 100 when using a large limit. */
101 denominator = ((EMACS_UINT)1 << FIXNUM_VALBITS) / XFIXNUM (limit); 101 denominator = (UE1 << FIXNUM_VALBITS) / XFIXNUM (limit);
102 do 102 do
103 val = get_random () / denominator; 103 val = get_random () / denominator;
104 while (val >= XFIXNUM (limit)); 104 while (val >= XFIXNUM (limit));
105 } 105 }
106 else 106 else