public BallSimulation()
 {
     for (int i = 0; i < numberofballs; i++)
     {
         balls.Add(ball = new Ball(rand)); //new ball object
     }
 }
 public void hitwall(Ball ball)
 {
     if (ball.BallPos.X + ball.getballradius > 1.0 || ball.BallPos.X - ball.getballradius < 0.0) //If ball bounces <---->
     {
         ball.setballVelocityX();
     }
     if (ball.BallPos.Y + ball.getballradius > 1.0 || ball.BallPos.Y - ball.getballradius < 0.0) //If ball bounces ^ v
     {
         ball.setballVelocityY();
     }
 }