Kaydet (Commit) 12fb2f41 authored tarafından Raymond Hettinger's avatar Raymond Hettinger

Code simplification suggested by Sven Marnach.

...@@ -402,11 +402,9 @@ class Random(_random.Random): ...@@ -402,11 +402,9 @@ class Random(_random.Random):
# lambd: rate lambd = 1/mean # lambd: rate lambd = 1/mean
# ('lambda' is a Python reserved word) # ('lambda' is a Python reserved word)
random = self.random # we use 1-random() instead of random() to preclude the
u = random() # possibility of taking the log of zero.
while u <= 1e-7: return -_log(1.0 - self.random())/lambd
u = random()
return -_log(u)/lambd
## -------------------- von Mises distribution -------------------- ## -------------------- 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