diff -cr ../Python-1.5.orig/Lib/random.py ./Lib/random.py *** ../Python-1.5.orig/Lib/random.py Tue Dec 9 20:43:18 1997 --- Lib/random.py Thu Mar 12 19:46:11 1998 *************** *** 182,193 **** # When x and y are two variables from [0, 1), uniformly # distributed, then # ! # cos(2*pi*x)*log(1-y) ! # sin(2*pi*x)*log(1-y) # # are two *independent* variables with normal distribution # (mu = 0, sigma = 1). # (Lambert Meertens) global gauss_next --- 182,194 ---- # When x and y are two variables from [0, 1), uniformly # distributed, then # ! # cos(2*pi*x)*sqrt(-2*log(1-y)) ! # sin(2*pi*x)*sqrt(-2*log(1-y)) # # are two *independent* variables with normal distribution # (mu = 0, sigma = 1). # (Lambert Meertens) + # (corrected version; bug discovered by Mike Miller, fixed by LM) global gauss_next *************** *** 196,204 **** gauss_next = None else: x2pi = random() * TWOPI ! log1_y = log(1.0 - random()) ! z = cos(x2pi) * log1_y ! gauss_next = sin(x2pi) * log1_y return mu + z*sigma --- 197,205 ---- gauss_next = None else: x2pi = random() * TWOPI ! g2rad = sqrt(-2.0 * log(1.0 - random())) ! z = cos(x2pi) * g2rad ! gauss_next = sin(x2pi) * g2rad return mu + z*sigma