This is within the domain of physics, but I am interested in this problem from a mathematical / probability perspective.
Suppose a mass on a spring is pulled to a length A and released. The mass undergoes harmonic oscillation. I know that the motion is of the form:
$$x(t) = A \cos(\omega t + \phi) $$
Now I am interested in finding the probability density function of the position $x$ at time $t$, assuming time is a random variable uniformly distributed along the period of oscillation. How can this be done, given the above formula?
Let $Τ$ be a uniform random variable on $\left[0,\frac{2\pi}{\omega}\right]$ that describes time. Then $F_T(t)=\frac{ωt}{2\pi}=ft$, where $f$ is the oscilation's frequency. Now, let:
$$X=A\cos(ωT+\phi)$$
be the random varoalbe describing $x$ in terms of $T$. We have:
$$\begin{align} F_X(x)&=P(X≤x)=P(A\cos(ωT+\phi)\leq x)=P\left(\cos(ωT+\phi)\leq \frac{x}{A}\right)=\\ &=P\left(\arccos\frac{x}{A}\leqωT+\phi\leq 2\pi-\arccos\frac{x}{A}\right)=\\ &=P\left(\frac{\arccos\frac{x}{A}-\phi}{\omega}\leq T\leq\frac{2\pi-\arccos\frac{x}{A}-\phi}{\omega}\right)=\\ &=F_T\left(\frac{2\pi-\arccos\frac{x}{A}-\phi}{\omega}\right)-F_T\left(\frac{\arccos\frac{x}{A}-\phi}{\omega}\right). \end{align}$$
Differentiating both sides, we get:
$$f_X(x)=f_T\left(\frac{\arccos\frac{x}{A}-\phi}{\omega}\right)\frac{\left(-\arccos\frac{x}{A}\right)'}{\omega}-f_T\left(\frac{2\pi-\arccos\frac{x}{A}-\phi}{\omega}\right)\frac{\left(\arccos\frac{x}{A}\right)'}{\omega}.$$
Now, since $f_T(t)=f=\frac{\omega}{2\pi}$ and $\arccos'x=-\frac{1}{\sqrt{1-x^2}}$, we have:
$$f_X(x)=\frac{1}{2\pi}\left(\frac{1}{A\sqrt{1-x^2/A^2}}+\frac{1}{A\sqrt{1-x^2/A^2}}\right)=\frac{1}{πA \sqrt{1-x^2/A^2}},$$ or, pushing $A$ into the root:
$$f_X(x)=\frac{1}{\pi\sqrt{A^2-x^2}},\ x\in(-A,A).$$
Note how nicely the probability is unaffected by angular velocity and initial phase ($\omega,\phi$), which is, intuitively, expected.
Edit: For @Keith McClary's confirmation, we can observe that:
$$f_X(x)=\frac{\omega}{\pi |v(x)|},$$
where $v(x)$ is the object's velocity at position $x$.