Github user mateiz commented on a diff in the pull request:
https://github.com/apache/spark/pull/477#discussion_r11938312
--- Diff: python/pyspark/rdd.py ---
@@ -381,13 +382,11 @@ def takeSample(self, withReplacement, num, seed):
# If the first sample didn't turn out large enough, keep trying to
take samples;
# this shouldn't happen often because we use a big multiplier for
their initial size.
# See: scala/spark/RDD.scala
+ rand = Random(seed)
while len(samples) < total:
- if seed > sys.maxint - 2:
- seed = -1
- seed += 1
- samples = self.sample(withReplacement, fraction,
seed).collect()
+ samples = self.sample(withReplacement, fraction,
rand.randint(0,sys.maxint)).collect()
- sampler = RDDSampler(withReplacement, fraction, seed+1)
+ sampler = RDDSampler(withReplacement, fraction,
rand.randint(0,sys.maxint))
--- End diff --
Put spaces after the comma here and in other instances of
`randint(0,sys.maxint)`
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---