[ https://issues.apache.org/jira/browse/SPARK-3578?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14138188#comment-14138188 ]
Apache Spark commented on SPARK-3578: ------------------------------------- User 'ankurdave' has created a pull request for this issue: https://github.com/apache/spark/pull/2439 > GraphGenerators.sampleLogNormal sometimes returns too-large result > ------------------------------------------------------------------ > > Key: SPARK-3578 > URL: https://issues.apache.org/jira/browse/SPARK-3578 > Project: Spark > Issue Type: Bug > Affects Versions: 1.2.0 > Reporter: Ankur Dave > Assignee: Ankur Dave > Priority: Minor > > GraphGenerators.sampleLogNormal is supposed to return an integer strictly > less than maxVal. However, it violates this guarantee. It generates its > return value as follows: > {code} > var X: Double = maxVal > while (X >= maxVal) { > val Z = rand.nextGaussian() > X = math.exp(mu + sigma*Z) > } > math.round(X.toFloat) > {code} > When X is sampled to be close to (but less than) maxVal, then it will pass > the while loop condition, but the rounded result will be equal to maxVal, > which will fail the test. > For example, if maxVal is 5 and X is 4.9, then X < maxVal, but > math.round(X.toFloat) is 5. > A solution is to round X down instead of to the nearest integer. -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org