create reusable function to get a random vector inside the canvas