File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -38,15 +38,18 @@ def getUniformSample(self):
3838 return self ._random .random ()
3939
4040 def getPoissonSample (self , mean ):
41- # Using Knuth's algorithm described in http://en.wikipedia.org/wiki/Poisson_distribution
42- if mean < 20.0 : # one exp and k+1 random calls
41+ # Using Knuth's algorithm described in
42+ # http://en.wikipedia.org/wiki/Poisson_distribution
43+ if mean < 20.0 :
44+ # one exp and k+1 random calls
4345 l = math .exp (- mean )
4446 p = self ._random .random ()
4547 k = 0
4648 while p > l :
4749 k += 1
4850 p *= self ._random .random ()
49- else : # switch to the log domain, k+1 expovariate (random + log) calls
51+ else :
52+ # switch to the log domain, k+1 expovariate (random + log) calls
5053 p = self ._random .expovariate (mean )
5154 k = 0
5255 while p < 1.0 :
You can’t perform that action at this time.
0 commit comments