Commit 2e075ebb authored by Julian Zobel's avatar Julian Zobel
Browse files

Added a 0 check for the random position distribution, such that nodes can be placed at height 0.

parent fac204f7
......@@ -38,7 +38,15 @@ public class RandomPositionDistribution extends PositionDistribution {
Random r = Randoms.getRandom(RandomPositionDistribution.class);
double[] vec = new double[getDimensions()];
for (int i = 0; i < getDimensions(); i++) {
vec[i] = r.nextInt((int) getWorldDimensions().getEntry(i));
int dim = (int) getWorldDimensions().getEntry(i);
if(dim == 0) {
vec[i] = 0;
}
else {
vec[i] = r.nextInt(dim);
}
}
PositionVector position = new PositionVector(vec);
return position;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment