python/pyspark/rdd.py
def sample(self, withReplacement, fraction, seed):
        """
        Return a sampled subset of this RDD (relies on numpy and falls back
        on default random generator if numpy is unavailable).

        >>> sc.parallelize(range(0, 100)).sample(False, 0.1, 2).collect() #doctest: +SKIP
        [2, 3, 20, 21, 24, 41, 42, 66, 67, 89, 90, 98]
        """
        assert fraction >= 0.0, "Invalid fraction value: %s" % fraction
        return self.mapPartitionsWithIndex(RDDSampler(withReplacement, fraction, seed).func, True)

        Return a sampled subset of this RDD (relies on numpy and falls back
        on default random generator if numpy is unavailable).

        >>> sc.parallelize(range(0, 100)).sample(False, 0.1, 2).collect() #doctest: +SKIP
        [2, 3, 20, 21, 24, 41, 42, 66, 67, 89, 90, 98]
        
Return a sampled subset of this RDD (relies on numpy and falls back
on default random generator if numpy is unavailable).


Return a sampled subset of this RDD ( relies on numpy and falls back on default random generator if numpy is unavailable ) .
def sample(self, withReplacement, fraction, seed):
        assert fraction >= 0.0, "Invalid fraction value: %s" % fraction
        return self.mapPartitionsWithIndex(RDDSampler(withReplacement, fraction, seed).func, True)
def sample ( self , withReplacement , fraction , seed ) : assert fraction >= 0.0 , "Invalid fraction value: %s" % fraction return self . mapPartitionsWithIndex ( RDDSampler ( withReplacement , fraction , seed ) . func , True )
Return a sampled subset of this RDD (relies on numpy and falls back
on default random generator if numpy is unavailable).
Return a sampled subset of this RDD ( relies on numpy and falls back on default random generator if numpy is unavailable ) .
"""
        Return a sampled subset of this RDD (relies on numpy and falls back
        on default random generator if numpy is unavailable).

        >>> sc.parallelize(range(0, 100)).sample(False, 0.1, 2).collect() #doctest: +SKIP
        [2, 3, 20, 21, 24, 41, 42, 66, 67, 89, 90, 98]
        """
self
withReplacement
fraction
seed