If you use sine and cosine, you can create a velocity for the ball at a particular angle and speed.

speed = 10; // set desired speed
angle = random(360); // set desired angle

speedX = Math.cos(angle*Math.PI/180)*speed;
speedY = Math.sin(angle*Math.PI/180)*speed;

In my own programs, I typically use the variable names vx and vy instead of speedX and speedY, to more clearly indicate that these represent velocity in a particular direction.

If you'd like to figure out the current speed and angle from speedX, and speedY, there's a way to do that to (using Math.atan2 and Math.sqrt).