Commit cba87311 authored by Raymond Hettinger's avatar Raymond Hettinger

Code simplification suggested by Sven Marnach.

parent cb9bf1ac
...@@ -427,11 +427,9 @@ class Random(_random.Random): ...@@ -427,11 +427,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