make sure we don't build circles with zero radius in ShapeTestUtil

This commit is contained in:
iverase 2020-10-05 10:45:31 +02:00
parent 1038fe8bee
commit 0864b39a11
1 changed files with 5 additions and 1 deletions

View File

@ -71,7 +71,11 @@ public class ShapeTestUtil {
Random random = random();
float x = nextFloat(random);
float y = nextFloat(random);
float radius = random().nextFloat() * Float.MAX_VALUE / 2;
float radius = 0;
while (radius == 0) {
radius = random().nextFloat() * Float.MAX_VALUE / 2;
}
assert radius != 0;
return new XYCircle(x, y, radius);
}