This is a useful enough problem for others to provide a solution w/o the student making any effort at all.
They get one freebie.
In general if you want to generate a random variable with a CDF [MATH]F(x)[/MATH]You generate a uniform random variate [MATH]u[/MATH] in [0,1] and let
[MATH]X = F^{-1}(u)[/MATH]
But that only works if [MATH]F[/MATH] has an inverse. If it doesn't you have to get clever.
In this case [MATH]F[/MATH] does not have an inverse, but it's domain can be partitioned into two subsets each on which it does.
Obviously in this case the two sets are [MATH](-\infty,0), [0, \infty)[/MATH].
So what we do is generate a random variable on [MATH][0, \infty)[/MATH] and then flip a coin for the sign.
[MATH]F(x) = \int f(x)~dx = \dfrac{\arctan(x)}{\pi}[/MATH] but we're only considering half the domain so we have to add a factor of 2
of course we can only be so casual about all this because the distribution is symmetric about 0.
[MATH]F(x) = \dfrac{2}{\pi} \arctan(x),~x \in \mathbb{R}^+\cup \{0\}[/MATH]
[MATH]F^{-1}(x) = \tan\left(\dfrac{\pi x}{2}\right),~x \in \mathbb{R}^+\cup \{0\}[/MATH]
So....
Fire up your trusty rng that generates uniform real numbers in the range of [MATH][0,1][/MATH]and generate [MATH]u_1,~u_2[/MATH]
[MATH]X = (2[u_1]-1) \cdot \tan\left(\dfrac{\pi u_2}{2}\right)[/MATH]
where
[MATH][x] = \begin{cases}1 &x \geq \dfrac 1 2\\0 &x < \dfrac 1 2\end{cases}[/MATH]