Skip to content

Commit 5c438d7

Browse files
author
Davies Liu
committed
fix comment
1 parent c5b9252 commit 5c438d7

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

python/pyspark/rddsampler.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff 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:

0 commit comments

Comments
 (0)