Github user mengxr commented on a diff in the pull request:
https://github.com/apache/spark/pull/3680#discussion_r22062817
--- Diff:
mllib/src/main/scala/org/apache/spark/mllib/random/RandomDataGenerator.scala ---
@@ -99,3 +99,69 @@ class PoissonGenerator(val mean: Double) extends
RandomDataGenerator[Double] {
override def copy(): PoissonGenerator = new PoissonGenerator(mean)
}
+
+/**
+ * :: DeveloperApi ::
+ * Generates i.i.d. samples from the exponential distribution with the
given mean.
+ *
+ * @param mean mean for the exponential distribution.
+ */
+@DeveloperApi
+class ExponentialGenerator(val mean: Double) extends
RandomDataGenerator[Double] {
+
+ private var rng = new ExponentialDistribution(mean)
+
+ override def nextValue(): Double = rng.sample()
+
+ override def setSeed(seed: Long) {
+ rng = new ExponentialDistribution(mean)
--- End diff --
Is this line necessary?
---
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]