I'm trying to generate random numbers for the x and y pos of the ball (to put it inside a rectangle), and the random doesn't seem to work right (with numbers, and with parameters)
public Ball createBall(int upper, int lower, int radius){
Random rand = new Random();
int temp = lower + radius;
int temp2 = upper - radius;
int x = rand.nextInt(600) + 450;
int y = rand.nextInt(temp2) + temp;
Ball ball = new Ball(new Point(x,y), radius, Color.BLACK);
return ball;
}
Aucun commentaire:
Enregistrer un commentaire