Github user jkbradley commented on the pull request:

    https://github.com/apache/spark/pull/1269#issuecomment-68401156
  
    @akopich The right way to do pseudo-randomness is to do:
    ```
    val randomSeed = ... // if you want to pass in a seed
    indx.mapPartitionsWithIndex { case (partitionIndex, iterator) =>
      // Use the partition index to make a different but deterministic seed for 
each partition.
      val random = new java.util.Random(partitionIndex + randomSeed)
      iterator.map(random.nextInt)
    }
    ```
    You can find examples in, e.g., mllib/tree/impl/BaggedPoint.scala



---
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.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to