Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Simonstrator
PeerfactSim.KOM
Commits
2e075ebb
Commit
2e075ebb
authored
Sep 26, 2018
by
Julian Zobel
Browse files
Added a 0 check for the random position distribution, such that nodes can be placed at height 0.
parent
fac204f7
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/de/tud/kom/p2psim/impl/topology/placement/RandomPositionDistribution.java
View file @
2e075ebb
...
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment