Generate random angle with the x axis

Hey there!
I started studying RStudio a while ago and today I went through a question.
Considering the Cartesian place, I want to generate a random angle (deg or rad not important) with only the x-axis and I want to consider only the 180 degree angle of the two upper quadrants. I post a photo to make it clear.

Thx in advice for the replys.

Just draw one number from the uniform distribution on the interval [0,180] ?

#> [1] 81.22813
Created on 2021-07-31 by the reprex package (v2.0.0)

Thx for the reply!
Yeah I have already done this but I have to be sure that the interval is in the upper part of the plane, because if I want to draw the tangent of that angle I want a positive angular coefficient from 0 to 90 degree for example.

I studied mathematics in the Netherlands in Dutch so I may miss something here:
how do you 'draw the tangent of an angle'?
If you want the tangent to be positive then just restrict to the first quadrant (??)

I’m sorry I was meaning to calculate the tangent.
How can I restrict ?


This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.