Kaydet (Commit) 5279fb99 authored tarafından Raymond Hettinger's avatar Raymond Hettinger

Code simplification suggested by Sven Marnach.

üst dbfb9b89
......@@ -402,11 +402,9 @@ class Random(_random.Random):
# lambd: rate lambd = 1/mean
# ('lambda' is a Python reserved word)
random = self.random
u = random()
while u <= 1e-7:
u = random()
return -_log(u)/lambd
# we use 1-random() instead of random() to preclude the
# possibility of taking the log of zero.
return -_log(1.0 - self.random())/lambd
## -------------------- von Mises distribution --------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment