generateRandomPos function
Implementation
Vector2 generateRandomPos(
double x, double y, double mag, double width, double height) {
final pos = Vector2(x, y);
final vel = Vector2(randD(0, width), randD(0, height));
vel.sub(pos);
vel.normalize();
vel.scale(mag);
pos.add(vel);
return pos;
}