diff --git a/graphx/src/main/scala/org/apache/spark/graphx/util/GraphGenerators.scala b/graphx/src/main/scala/org/apache/spark/graphx/util/GraphGenerators.scala index 419731146d..ea531b6cf0 100644 --- a/graphx/src/main/scala/org/apache/spark/graphx/util/GraphGenerators.scala +++ b/graphx/src/main/scala/org/apache/spark/graphx/util/GraphGenerators.scala @@ -87,11 +87,10 @@ object GraphGenerators extends Logging { } /** - * Randomly samples from a log normal distribution whose corresponding normal distribution has - * the given mean and standard deviation. It uses the formula `X = exp(m+s*Z)` where `m`, - * `s` are the mean, standard deviation of the lognormal distribution and - * `Z ~ N(0, 1)`. In this function, - * `m = e^(mu+sigma^2/2)` and `s = sqrt[(e^(sigma^2) - 1)(e^(2*mu+sigma^2))]`. + * Randomly samples from the given mean and standard deviation of the normal distribution. + * It uses the formula `X = exp(mu+sigma*Z)` where `mu`, + * `sigma` are the mean, standard deviation of the normal distribution and + * `Z ~ N(0, 1)`. * * @param mu the mean of the normal distribution * @param sigma the standard deviation of the normal distribution @@ -102,10 +101,6 @@ object GraphGenerators extends Logging { mu: Double, sigma: Double, maxVal: Int, seed: Long = -1): Int = { val rand = if (seed == -1) new Random() else new Random(seed) - val sigmaSq = sigma * sigma - val m = math.exp(mu + sigmaSq / 2.0) - // expm1 is exp(m)-1 with better accuracy for tiny m - val s = math.sqrt(math.expm1(sigmaSq) * math.exp(2*mu + sigmaSq)) // Z ~ N(0, 1) var X: Double = maxVal