Skip to content

Commit

Permalink
Round X in loop condition
Browse files Browse the repository at this point in the history
  • Loading branch information
ankurdave committed Sep 20, 2014
1 parent 6fd5fb1 commit 5900c22
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,15 @@ object GraphGenerators {
// Z ~ N(0, 1)
var X: Double = maxVal

while (X >= maxVal) {
while (round(X) >= maxVal) {
val Z = rand.nextGaussian()
X = math.exp(mu + sigma*Z)
}
math.floor(X).toInt
round(X)
}

private def round(x: Double): Int = math.round(x.toFloat)

/**
* A random graph generator using the R-MAT model, proposed in
* "R-MAT: A Recursive Model for Graph Mining" by Chakrabarti et al.
Expand Down

0 comments on commit 5900c22

Please sign in to comment.