Question about the minigolf tutorial

Hi there, my question is probably too basic but I'm starting with this and I can't understand why do we use this function:

Ifit is a random position and I write the next:
Random integer from hole radius
To canvas1 widthhole radius

That means that my ball will start from at least a distance of its radius until the width of the canvas less its radius? but if I start in the middle of the canvas the ball will go over the edge. Thank you for your help!

Assuming the ball is much smaller than the canvas, that just makes sure the ball doesn't stick out over the edge of the canvas.

1 Like

Ok I got it, I was assuming that the initial possition started from the final possition of the ball (plus the radius to the canvas width less the radius), so now I understand that 0 position is the left limit of the canvas. Thank you so much!